App inventor 2: How to split at spaces

后端 未结 3 606
余生分开走
余生分开走 2021-01-23 07:10

I have a small question. I want to split the text at the space.

eg:

\"Hello World \"

should be

\"Hel

相关标签:
3条回答
  • 2021-01-23 07:27

    You can use String.split()

    String yourString = "Hello World";
    
    String[] result = yourString.split(" ");
    result[0]; //"Hello"
    result[1]; //"World"
    
    0 讨论(0)
  • 2021-01-23 07:37

    Why you need to use add item to list? Just use split at space function or split text at. Below is example of code. The result of length of list is 2:

    0 讨论(0)
  • 2021-01-23 07:53

    what about using the split at spaces block?

    Divides the given text at any occurrence of a space, producing a list of the pieces.

    A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook http://www.appinventor.org/book2 ... the links are at the bottom of the Web page. The book 'teaches' users how to program with AI2 blocks. There is a free programming course here http://www.appinventor.org/content/CourseInABox/Intro and the aia files for the projects in the book are here: http://www.appinventor.org/bookFiles
    How to do a lot of basic things with App Inventor are described here: http://www.appinventor.org/content/howDoYou/eventHandling .

    Also do the tutorials http://appinventor.mit.edu/explore/ai2/tutorials.html to learn the basics of App Inventor, then try something and follow the Top 5 Tips: How to learn App Inventor

    0 讨论(0)
提交回复
热议问题