Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [Solved] Truncate,trim strings in qml
Forum Update on Monday, May 27th 2025

[Solved] Truncate,trim strings in qml

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 9.9k Views
  • 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.
  • B Offline
    B Offline
    beemaneni
    wrote on 13 Aug 2014, 07:37 last edited by
    #1

    Hi
    I need to truncate or trim the first few characters of a string in qml.Does qml supports these functions?
    if so how do i do it?

    Ex:
    @
    property var string = "Thumb_Image"
    @

    The required output is "Image"

    Please help me if anyone knows the best solution

    Thanks in Advance
    Bala Beemaneni

    Bala B
    Infinite Computer systems
    Chennai

    1 Reply Last reply
    0
    • S Offline
      S Offline
      sierdzio
      Moderators
      wrote on 13 Aug 2014, 07:43 last edited by
      #2

      That code is actually JavaScript, so you can use the JS API for this: "link":http://www.w3schools.com/jsref/jsref_obj_string.asp.

      (Z(:^

      1 Reply Last reply
      0
      • B Offline
        B Offline
        beemaneni
        wrote on 13 Aug 2014, 10:02 last edited by
        #3

        Thanks sierdzio

        That solved my requirement

        @Ex:
        r_imageName = fileName.replace("Thumb_","")
        r_imageName = r_imageName.replace(".png",".jpg")@

        Thanks
        Bala Beemaneni

        Bala B
        Infinite Computer systems
        Chennai

        1 Reply Last reply
        0

        1/3

        13 Aug 2014, 07:37

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved