HISE Logo Forum
    • Categories
    • Register
    • Login

    Get the value of last 4 digits from a string

    Scheduled Pinned Locked Moved General Questions
    4 Posts 3 Posters 193 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ?
      A Former User
      last edited by

      Hello

      The user has a serial number (string) with 30 characters.

      When the user inserts this serial into the plugin, I can get the whole serial input string with getValue();

      What about if I only want to get the last 4 characters of this input? Any helps appreciated.

      ustkU 1 Reply Last reply Reply Quote 0
      • orangeO
        orange
        last edited by orange

        You can use .substring that substracts the choosen values from a string. (Start index: Begins from 0)

        develop Branch / XCode 13.1
        macOS Monterey / M1 Max

        1 Reply Last reply Reply Quote 1
        • ustkU
          ustk @A Former User
          last edited by ustk

          @Steve-Mohican You can use

          var subString = String.substring(String.length - 4, String.length);
          

          Can't help pressing F5 in the forum...

          1 Reply Last reply Reply Quote 2
          • ?
            A Former User
            last edited by

            Wow that was quick, thank you guys, you've been very helpful, much respect!!

            1 Reply Last reply Reply Quote 0
            • First post
              Last post

            23

            Online

            1.8k

            Users

            12.0k

            Topics

            104.4k

            Posts