# String manipulations

**URL:** <https://forum.kirupa.com/t/string-manipulations/5592>\
**Category:** Uncategorized\
**Created:** [September 17, 2002, 3:22am UTC](https://forum.kirupa.com/t/string-manipulations/5592 "2002-09-17T03:22:10Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![mediachickie](https://avatars.discourse-cdn.com/v4/letter/m/76d3ee/32.png) [@mediachickie](https://forum.kirupa.com/u/mediachickie)\
**Post date:** [September 17, 2002, 3:22am UTC](https://forum.kirupa.com/t/string-manipulations/5592/1 "2002-09-17T03:22:10Z")

</div>

I have a string manipulation questions:

Lets say I have a string that is a Path ( c:/thisdoc/thisdir/thisfile)-  
and I want to only get certain info from the string - such as “thisfile” - do I use split or splice? Any suggestions or tutorials that someone could point me to would be much appreciated.

thanks!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 17, 2002, 4:49am UTC](https://forum.kirupa.com/t/string-manipulations/5592/2 "2002-09-17T04:49:41Z")

</div>

split is for arrays

splice is for string manipulation

I am not sure how to use them, I only know that “splice” is the one you are looking for out of those 2.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 17, 2002, 5:13am UTC](https://forum.kirupa.com/t/string-manipulations/5592/3 "2002-09-17T05:13:53Z")

</div>

You have to use split:

```auto
//you have a string
myStr="c:/thisdoc/thisdir/thisfile";
//a is an array containing the elements separated by /
a=myStr.split("/");
//file is the last element of that array
file=a[a.length-1];
trace (file);

```

pom :asian:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 17, 2002, 5:16am UTC](https://forum.kirupa.com/t/string-manipulations/5592/4 "2002-09-17T05:16:49Z")

</div>

Hmm, I could have sworn splice was for strings and split was for arrays. Maybe I am confusing myself again…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 17, 2002, 5:37am UTC](https://forum.kirupa.com/t/string-manipulations/5592/5 "2002-09-17T05:37:53Z")

</div>

well, strings and arrays aer a bit alike… 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 17, 2002, 5:41am UTC](https://forum.kirupa.com/t/string-manipulations/5592/6 "2002-09-17T05:41:12Z")

</div>

Good to know…good to know. I really need to read up more on both. Actually, I really need to start buying books for what I am learning…haha.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 17, 2002, 7:05am UTC](https://forum.kirupa.com/t/string-manipulations/5592/7 "2002-09-17T07:05:42Z")

</div>

you could also use “lastIndexof” to get the last dash, and then retrieve the remaining substring based on that value…

How about a string manipulating contest?

And strings are not like arrays…are they…? lol The more i think about theur differences, the less there are…well anyway, they’re both usefull, so go get that (Moock) book!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 17, 2002, 7:08am UTC](https://forum.kirupa.com/t/string-manipulations/5592/8 "2002-09-17T07:08:57Z")

</div>

… ahh. .a string manipulation contest… I might actually have some luck with that one. Good idea Eyez

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 17, 2002, 10:00am UTC](https://forum.kirupa.com/t/string-manipulations/5592/9 "2002-09-17T10:00:32Z")

</div>

i think i need to get a book too…it would be good to actualy know what im doing for a change… :)hehe

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 17, 2002, 4:02pm UTC](https://forum.kirupa.com/t/string-manipulations/5592/10 "2002-09-17T16:02:56Z")

</div>

Ok, I am screwed enough in the AS contest, please don’t start a string manipulation contest…haha. Just kidding:)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 17, 2002, 7:43pm UTC](https://forum.kirupa.com/t/string-manipulations/5592/11 "2002-09-17T19:43:42Z")

</div>

Hmm… Strings are a bit like arrays, Eyez. Just a bit, but they are 🙂 I know C. Moock would disagree with me on that one, but hey…

pom :asian:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 17, 2002, 9:08pm UTC](https://forum.kirupa.com/t/string-manipulations/5592/12 "2002-09-17T21:08:05Z")

</div>

Sounds confusing… I am going to jump out of this thread before I hang myself with a String from an Array:P

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 18, 2002, 6:23am UTC](https://forum.kirupa.com/t/string-manipulations/5592/13 "2002-09-18T06:23:49Z")

</div>

well lost… really string manipulation is not that tough. If I know you, you’d pick up most of the principals pretty quickly.

You’ll need to know the basics of it to work with XML docs anyway. Many of the methods used on strings are very similar to methods used on XML nodes and Array for that matter. (which is why Pom says they are similar to each other.)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 18, 2002, 6:26am UTC](https://forum.kirupa.com/t/string-manipulations/5592/14 "2002-09-18T06:26:06Z")

</div>

Do you know any good tutorials on strings?

I have good info on Arrays, I just need to find something to teach me strings.

[http://www.flashmagazine.com/html/480.htm](http://www.flashmagazine.com/html/480.htm)  
[http://www.flashmagazine.com/html/509.htm](http://www.flashmagazine.com/html/509.htm)

There are the links on info I have on Arrays, I think it is pretty informative. Figured if anyone else read this and wanted to learn, they could use those links.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 18, 2002, 6:33am UTC](https://forum.kirupa.com/t/string-manipulations/5592/15 "2002-09-18T06:33:33Z")

</div>

Well… most of it’s pretty straight forward.

name the string and then call a string method. ie

someSting.length();

gives you the length of the value of the string.

There are, I guess, quite a few methods that you can use on strings which would be hard to post all of here. If I can find a good tutorial, I’ll pass it on… otherwise it looks like that will probebly be my next tutorial after the xml one. both the XML tutorial, and a ‘string’ tutorial will compliment each other anyway… so it certainly wont hurt to be creating both close together.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 18, 2002, 6:35am UTC](https://forum.kirupa.com/t/string-manipulations/5592/16 "2002-09-18T06:35:08Z")

</div>

Awesome, thanks david.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 18, 2002, 6:54am UTC](https://forum.kirupa.com/t/string-manipulations/5592/17 "2002-09-18T06:54:08Z")

</div>

Working on one too…sometimes, when i get time…will take some time…ti-i-i-ime is on my side…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 18, 2002, 6:17pm UTC](https://forum.kirupa.com/t/string-manipulations/5592/18 "2002-09-18T18:17:45Z")

</div>

…yyyes it iss. :nerd:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 18, 2002, 10:31pm UTC](https://forum.kirupa.com/t/string-manipulations/5592/19 "2002-09-18T22:31:37Z")

</div>

Hey Eyez, are you working on an XML tute or a String methods tute (for Lost, the best ressource I know: the AS dictionary)?

pom :asian:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 18, 2002, 11:31pm UTC](https://forum.kirupa.com/t/string-manipulations/5592/20 "2002-09-18T23:31:17Z")

</div>

arrays arn’t like strings…strings is just a string of caracters all joined to gether, where as an array is an ordered set of alike things like a set of numbers, letters, or values…arrays are easier to refer to a certian entry as well…you just use the myArray\*, with strings you would have to chop and change them to get the right thing…

I meant to reply to this yesterday…but my computer was anoying me…hehe oh well 🙂

[Next page](https://forum.kirupa.com/t/string-manipulations/5592.md?page=2)
