cancel
Showing results for 
Search instead for 
Did you mean: 

Breaking a string apart

SOLVED
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?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Hero

Re: Breaking a string apart

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
[Community Expert Group]
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
Extensions available
3 REPLIES 3
Community Hero

Re: Breaking a string apart

What code language are you using?


Robert Martin
[Community Expert Group]
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
Extensions available
Contributor

Re: Breaking a string apart

Java script 

Community Hero

Re: Breaking a string apart

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
[Community Expert Group]
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
Extensions available
New Here?
Join us and watch the welcome video:
Watch the new Interview
Top Kudoed Authors