diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-07-31 18:46:53 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-08-01 00:40:35 +0200 |
commit | 1418f97c70a5551bdbfeea853cbc479b32ea9e08 (patch) | |
tree | 6e1da09c80d7a739b4b9f5ace23b99aca5055cb7 /doc/classes | |
parent | 14828c331c6ce44a90160fbe9892346c4970116d (diff) |
File: Re-add support to skip CR (`\r`) in `File::get_as_text`
This was removed in #63481, and we confirmed that it's better like this,
but we add back the possibility to strip CR as an option, to optionally
restore the previous behavior.
For performance this is done directly in `String::parse_utf8`.
Also fixes Android `FileAccess::get_line()` as this one _should_ strip CR.
Supersedes #63717.
Diffstat (limited to 'doc/classes')
-rw-r--r-- | doc/classes/File.xml | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/doc/classes/File.xml b/doc/classes/File.xml index 0b4a8fa46e..3a2776ff21 100644 --- a/doc/classes/File.xml +++ b/doc/classes/File.xml @@ -115,9 +115,10 @@ </method> <method name="get_as_text" qualifiers="const"> <return type="String" /> + <argument index="0" name="skip_cr" type="bool" default="false" /> <description> - Returns the whole file as a [String]. - Text is interpreted as being UTF-8 encoded. + Returns the whole file as a [String]. Text is interpreted as being UTF-8 encoded. + If [code]skip_cr[/code] is [code]true[/code], carriage return characters ([code]\r[/code], CR) will be ignored when parsing the UTF-8, so that only line feed characters ([code]\n[/code], LF) represent a new line (Unix convention). </description> </method> <method name="get_buffer" qualifiers="const"> |