# String manipulation - functions (edited title)

**URL:** <https://forum.kirupa.com/t/string-manipulation-functions-edited-title/3400>\
**Category:** classic bestof\
**Created:** [March 31, 2002, 8:37am UTC](https://forum.kirupa.com/t/string-manipulation-functions-edited-title/3400 "2002-03-31T08:37:01Z")\
**Posts on this page:** 3\
**Page:** 1

<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:** [March 31, 2002, 8:37am UTC](https://forum.kirupa.com/t/string-manipulation-functions-edited-title/3400/1 "2002-03-31T08:37:01Z")

</div>

I don’t know if it’s possible but i would like to take the first, and the last letter from a word and compare it, it would be very usefull to me, please help me

---

<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:** [March 31, 2002, 9:39am UTC](https://forum.kirupa.com/t/string-manipulation-functions-edited-title/3400/2 "2002-03-31T09:39:38Z")

</div>

There are a few String methods you can check in the Actions Panel \> Function \> String.\rAbout your problem, let’s say you have a DYNAMIC text box on the scene that you called “text”, with the word “Salut” in it. If you put this code in teh first frame of the timeline :

```auto
 a = text.length ;\r\rb = text.charAt(0) ;\r\rc = text.charAt(a-1) ;\r\rtrace (a) ;\r\rtrace (b) ;\r\rtrace (c) ;

```

you’ll get 5, S, t.\r\rpom 0]

---

<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:** [May 26, 2002, 3:58pm UTC](https://forum.kirupa.com/t/string-manipulation-functions-edited-title/3400/3 "2002-05-26T15:58:38Z")

</div>

More about Strings methods. Let’s say that your Dynamic Textbox ‘text’ now contains “azertyuitop”.

```auto
   trace (text.substr (2,3)) ;\r\r//returns 'ert' that is to say 3 letters from the letter indexed as 2, that is to say the \r\r//3rd because the index start from 0\r\r\r\rtrace (text.substring (2,4)) ;\r\r//returns 'er' that is to say letters from index 2 to 4-1. That's how it works, don't ask me why.\r\r\r\rtrace (text.indexOf ("t")) ;\r\r//returns 4 -> first instance of t.\r\r\r\rtrace (text.lastIndexOf ("t")) ;\r\r// returns 8, the last index of the string

```

pom 0]
