Jump to content

Recommended Posts

Posted

what's it called when you have \n instead of @CRLF in a string?

how to convert that? i know i can use StringReplace(), but i need to check the backslash itself is not escaped, and to handle other such indicators like \r , and maybe others i don't know about. so i'm asking what is the formal name of that string format, so i can understand it and search for some native function for conversion (which i'm certain exists somewhere).

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Posted

i know it's a new line (EOL). i want to be able to convert it safely to @CRLF, and to convert \r and others to their respective special characters, which i don't know, so i'm asking what is the formal name of this "format" or "standard" of special characters representation in a string.

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Posted

not sure what you mean by formal, unless you are talking about the ASCII characters,

which CR (Carriage Return) would be  Chr(13)

and LF (Line Feed) would be Chr(10)

If @error Then
    MsgBox(262192, "", @ComputerName & " slaps " & @UserName & " around a bit with a large trout!")
EndIf

"Yeah yeah yeah patience, how long will that take?"  -Ed Gruberman

REAL search results  |  SciTE4AutoIt3 Editor Full Version

Posted

@orbs

Thanks for the clarification.

So, \n is a representation of a "new line"...

It's just a character, which has various representations in some formats (character : \n, Unicode : U+000A, ASCII : 10, hex : 0x0a).

By the way, \n and \r are two different chracters, and so, they are threated in a different manner.

For example, the character \n, traduced in .au3 would be just @LF, while \r would be @CR; so, @CRLF is a sequence of \r\n.

If you want to traduce the \n with his corresponding character in .au3, then you need to use just @LF, and so on :)

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Posted (edited)

ok. so i need to read the text char by char, and if i find unescaped substring "\n" then i StringReplace() it with @LF, and "\r" with @CR. there is probably a regexp to do that, but i'm no regex expert.

that is all good and well, but:

1) i wonder if there are other special characters, @TAB for example, that has such a representation (of a backslash followed by a normal character), and handle them as well - is there any formal specification for that?

2) i'm probably not the first to encounter such a task, there is probably already a function doing just that - how do i search for it? what do i type in google?

 

P.S. the text is generated by a python script, which i can modify. i guess python prefers using \n and \r, but it may be possible to tell python to use chr(10) and chr(13) instead. i'll look into that.

Edited by orbs

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Posted

no problem. a very simple example:

\n\nline with two blank lines before, and two blank lines after\n\n

i'll get you a more decent example shortly :-)

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Posted

UPDATE: i think the way i'm going to tackle this is on the python side, i'm going to process the text for AutoIt-compliant format before output. preliminary test suggest it is easier. trying it now...

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Posted

yup, got in on the python side. now for the AutoIt post-processor, see how it goes. thanks for all the help so far, i will update here if any issues arise.

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Posted

indeed. thank you @user4157124. although i currently no longer need the solution, it's good to know it's there.

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...