ptp
USA
Asked
— Edited
what i want to do:
$pos = IndexOf($buffer, "\n")
this is what i tried without success
$pos = IndexOf($buffer, 0x0a)
i didn't find an equivalent function to:
$NewLine = char(13) + char(10)
i just went back & forward in the script help, i went also to the learning section just to see if i was missing something.
but nothing come up.
I feel bad, it must be really simple...
I'll try tomorrow.
@ptp, I am assuming you want to start a new line? Or create a break in speech?
Either way the best way to do that would be to place each "new line" in its own array index, this way you can call them individually, if need. The code below should help with that, I tried to comment it as much as possible to help you understanding the methodology.
I uploaded an example of this to the cloud if you want to see it working as well. https://synthiam.com/User/mikebmac/CloudFiles It is called "Stripping /n"
Here is a picture of how the array turns out, along with any variables that are used.
@mikebmac
I didnt tested but my issue is: i need the character \n (0x0a)
In your example does "/n" represents that character?
I didnt see anywhere "/" is the escaping char.
/n is just the string it looks for to escape and go to the next line. Just replace that with whatever you want to use. If you just need a forward slash replace the /n with just a "/". I have work at the moment, but I will try to update it after work to reflect that.
thanks for helping the troubleshooting.
the main issue is how to create a string with the character ascii code 10 (0x0a).
EZ-Script originally wasn't designed for more than one line - the regex on the parser doesn't deal with that well. I'll revisit the parser and come up with something
Like JD said, Strings can only be one line, but you can add a new line by using:
But you will not be able to save this to string as a variable because of the newlines in it. This is why I use arrays to get around this limitation, though if JD is going to add newline support that would be awesome.
Maybe something like C# with the @"String" would be nice.
Until then, I would recommend using the literal string "\n" and saving it as an array as shown above.
Sorry we couldn't get it to satisfaction... blush