Sign in to follow this  
Followers 0
motionman95

Multiline Strings

24 posts in this topic

#1 ·  Posted (edited)

Yo,

I have a string that has lots of ' " ' and other signs that would cause a string to break. This string is very long, and changes often. I would just use ' "" ' if I could. I want to be able to do something like this, and not worry about the ' " ' signs conflicting:

$string = (<r><![CDATA[

   "Polly goes for a walk, in "Central" Park"

]]></r>)

Is there a way to do this in Autoit?

Thanks in advance.

Edited by motionman95

Share this post


Link to post
Share on other sites



Depending on how long the string is, why not use & signs? Or check if there are any single quote signs (') and put the string inside of those, like $String = '@#$(*!@(#*!@#(!*@###(*$"$%"#$%"!#!@"#@$"@#$%@#$"').

Share this post


Link to post
Share on other sites

'Polly goes for a walk, in "Central" Park'

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

@epdmk

The string is super long, it would take a long time to go through it. Plus it has a combination of ' and " symbols.

BTW, thanks for replying and trying to help. :blink:

Edited by motionman95

Share this post


Link to post
Share on other sites

Can you post the string?

Share this post


Link to post
Share on other sites

Can you post the string?

It contains...sensitive information...

Share this post


Link to post
Share on other sites

Ok, can you post an example that is similar?

Share this post


Link to post
Share on other sites

Ok, can you post an example that is similar?

Thanks for being so patient!

"if(bird = "'") { be='"' }"

Something like that, except super duper long. It's actually a JS file for a site.


Share this post


Link to post
Share on other sites

Are you declaring the lines of these strings yourself; where are they from?

Share this post


Link to post
Share on other sites

I had a similar situation, so eventually ended up reading the long string from a file then assigning it to variable.

Share this post


Link to post
Share on other sites

@epdmk

Not understanding you - are you asking if the string is loaded, or if it is in the source of the au3? It is in the source of the au3.


Share this post


Link to post
Share on other sites

@871:

I was considering that, except that the compiled exe is going to be use on multiple machines.


Share this post


Link to post
Share on other sites

Well I was thinking in terms of making it an array instead.. if your grabbing the information for this string from a website or text file it would be as simple as that, an array.

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

@epdmk

I'm sorry, earlier when I said "JS file" I meant it is a string of Javascript...

But could you explain your Array idea?

Edited by motionman95

Share this post


Link to post
Share on other sites

Example:

#include <INet.au3>
#include <Array.au3>
$String = _INetGetSource('http://google.com')
$String = StringSplit($String, '"')
_ArrayDisplay($String)

Share this post


Link to post
Share on other sites

In terms of what 871 said then you could try:

FileWrite('tempfilename.txt', 'text')
$String = FileRead('tempfilename.txt')
FileDelete('tempfilename.txt')
MsgBox(64, 'Example', $String)

Share this post


Link to post
Share on other sites

@epdmk

I don't need the string turned into an array, (o_O). I just need to be able to do this:

"Polly goes for a walk, in "Central" Park"

Without worrying about getting errors. I also asked the question because I noticed that some languages had ways to do this...


Share this post


Link to post
Share on other sites

Does It matter whether the end string has single or double quotations throughout the string?

Not understanding...?

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0