Jump to content
Sign in to follow this  
motionman95

Multiline Strings

Recommended Posts

motionman95

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
Pottery

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
Pottery

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

Share this post


Link to post
Share on other sites
motionman95

@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
motionman95

Can you post the string?

It contains...sensitive information...

Share this post


Link to post
Share on other sites
Pottery

Ok, can you post an example that is similar?

Share this post


Link to post
Share on other sites
motionman95

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
Pottery

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

Share this post


Link to post
Share on other sites
StandardUser

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
motionman95

@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
motionman95

@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
Pottery

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
motionman95

@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
Pottery

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
Pottery

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
motionman95

@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
motionman95

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
JohnOne

You have for example the string "'Mary' had a little "lamb", its nose 'was' "red" and 'white'"

Would it matter to your script if it were ""Mary" had a little "lamb", its nose "was" "red" and "white""

?


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.