×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Dec 2011
    Posts
    30

    QML tokenizer or split

    hi
    i want to tokenize or split a string in QML.please let me know how can i do?suppose my string is here

    property srting testString ="this is a normal string"

    i want to split on spaces base.i want result like
    this
    is
    a
    normal string



    thankx in advance

  2. #2
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    4,089

    Re: QML tokenizer or split

    What happen if you yourself append a \n after each word?

  3. #3
    Registered User
    Join Date
    Dec 2011
    Posts
    30

    Re: QML tokenizer or split

    sir acctually my string comes from c++ side and i want to tokenize in qml side is it possible
    when i got string in qml side as a slot it is like as
    function testdate(testString){
    console.log(testString)
    // out put is ."this is a normal string"
    }
    i want to tokenize this in qml sie..
    really sorry for asked query in improper style..
    thanks

  4. #4
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    4,089

    Re: QML tokenizer or split

    Ok.So you can run a loop(may be a for or while) to find the spaces in the sentence & replace each space with \n & then print/display the string.I do not know any ready made method for this, so you may give a try with this suggested way.

  5. #5
    Registered User
    Join Date
    Dec 2011
    Posts
    30

    Re: QML tokenizer or split

    ok sir let me try

  6. #6
    Registered User
    Join Date
    Jul 2011
    Posts
    12

    Re: QML tokenizer or split

    Use JavaScript's string split. Example:

    var testString ="this is a normal string"
    var words = testString.split(" ")

    words is an array with each element being an individual word.

Similar Threads

  1. String Tokenizer
    By Arunesh in forum Mobile Java General
    Replies: 2
    Last Post: 2009-08-06, 14:07
  2. how to split str?
    By nokia_lin in forum Symbian
    Replies: 5
    Last Post: 2009-04-30, 10:55
  3. String tokenizer
    By kerfunkledbongle in forum Symbian
    Replies: 3
    Last Post: 2006-05-01, 20:33
  4. String parsing / String Tokenizer
    By khurshed79 in forum Symbian
    Replies: 0
    Last Post: 2005-08-08, 13:30
  5. String tokenizer?
    By cbrueckner in forum Symbian
    Replies: 9
    Last Post: 2003-07-31, 10:10

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×