Skip to main content
February 28, 2024
Question

Remove space

  • February 28, 2024
  • 7 replies
  • 0 views

Hi 
I am trying to remove space Infront of 9 as shown in below image 

I tried with trim but still the space is coming < can anyone help me with this?
Attached my code in this message

a!localVariables(
  local!allocatedLoads: rule!PLSB_QR_queryAllocatedLoadsForDashboard(allocatedId: 2058),
  local!vin:trim(local!allocatedLoads['recordType!{e48e7749-5c4f-4ece-89a1-1f096042fbc5}PLSB Allocated Loads.fields.{e79eb6a6-7005-42cb-ae7e-72dcb80c9d34}vinNo'][1]),
  local!vin
)

    7 replies

    mathieud0001
    February 28, 2024
    mikes0011
    Brainy
    February 28, 2024

    i'd actually suggest trim()... it's specifically for this sort of thing TBH.

    mathieud0001
    February 29, 2024

    He already tried using trim() and it didn't work which is why I assumed there were non-printable spaces in there.

    i.e. www.namecheap.com/.../

    a!localVariables(
      local!nonPrintableSpaces: { "â`Š", "â`†", "â`‰", "â`ˆ", "â`…", "â`„", "â`‡", "â`‚", "â`ƒ" },
      local!characterString: concat(local!nonPrintableSpaces),
      local!trim: trim(local!characterString),
      local!stripPlusTrim: stripwith(local!trim," "),
      local!cleanPlusTrim: clean(local!trim),
      {
        characterCodes: code(local!nonPrintableSpaces),
        trim: local!trim,
        stripPlusTrim: local!stripPlusTrim,
        cleanPlusTrim: local!cleanPlusTrim
      }
    )

    harshitb6843
    February 28, 2024

    Depends on what is the value. It is going to be a sentence where you only want to remove extra spaces but would want keep the right number of space between every word, then like Mathieu said, you can go with clean. 

    But if you want to remove all the spaces, no matter what, then substitute can help you. 

    jayaprakashr0001
    February 28, 2024

    hi [mention:e300e7c35d4a422492d7e821e4d60813:e9ed411860ed4f2ba0265705b8793d05] ,

    you can also use the trim() function to remove the unwanted spaces.