• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Seperate String by Character

Explorer ,
Dec 29, 2011 Dec 29, 2011

Copy link to clipboard

Copied

What I am after, is taking a string, then taking each character in that string and making it a variable, then displaying each character by itself. My problem is figuring that out. I thought I would try using a for loop and creating each character variable like that, but it doesn't work. I doesn't display anything. Here is my code so far, it seems like the closest thing I've gotten to:

for (var i:Number=1; i<=myString.length; i++)
   {
    var letNum:String = myString.charAt(i);
    var let:String = letNum;

   }

Is there a way to do this? Am I on the right track?

TOPICS
ActionScript

Views

510

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Dec 29, 2011 Dec 29, 2011

var s:String="whatever";

var a:Array=s.split("");

you know have variables (a[0], a[1],...) with values = to the letters of s.

Votes

Translate

Translate
Community Expert ,
Dec 29, 2011 Dec 29, 2011

Copy link to clipboard

Copied

LATEST

var s:String="whatever";

var a:Array=s.split("");

you know have variables (a[0], a[1],...) with values = to the letters of s.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines