AS3 Get the Last Char in a String


/ Published in: ActionScript 3
Save to your folder(s)

Returns the last character is a string.


Copy this code and paste it in your HTML
  1. function getLastCharInString($s:String):String
  2. {
  3. return $s.substr($s.length-1,$s.length);
  4. }
  5.  
  6. trace(getLastCharInString("abcdefg"));
  7.  
  8. // OUTPUT
  9. // g

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.