Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: Is "split" a valid command for a string?

Threaded View

  1. #1
    Member
    Join Date
    Dec 2016
    Location
    Buena Park ca
    Posts
    87

    Is "split" a valid command for a string?

    I does show in red in the IDE , so it does exists, but I get a
    'class String' has no member named 'split'

    Long story short, I am trying to extract values (Floats) from a string based on the space between them

    FromTablet = Serial5.readStringUntil('\n'); gets me:

    g 117.1 230.0 112.9 180.0 54.8 77.7 112.9 0.0 Is my incoming string ended in a newline

    Then I tried
    String AngStr[20] = FromTablet.split(" "); ( found it on some forums...)

    hoping to get a bunch of baby strings containing my values,

    Then I would convert those to Floats such as:

    AngStr_float[1] = AngStr[1].toFloat();
    etc

    Any ideas of the most efficient way to do this?
    Thanks
    Mitch
    Last edited by laptophead; 02-02-2020 at 01:42 AM.

Posting Permissions

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