Ask a Question

Breaking a string apart

SOLVED
4m4d3u5
Contributor

Breaking a string apart

I have a string 100C and I want to break up this string into it's two parts so that I get 100 C. What would be the best way to go about that?

 

3 REPLIES 3
tristaanogre
Esteemed Contributor

What code language are you using?


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

Java script 

tristaanogre
Esteemed Contributor

In JavaScript, strings are, essentially, arrays of individual characters.  So, you could write a JavaScript routine to go through each character in the string to grab everything up to the C, place those in one string... append a space... and then append the C.

 

Alternatively, you could use the aqString.Find method to find the location of the C, use aqString.SubString to get everything up to but not including the C and put it in one variable, append a space, and then append the C.

 

Multiple ways... but it's going to take code of string manipulation to do so.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
cancel
Showing results for 
Search instead for 
Did you mean: