Results 1 to 5 of 5

Thread: Trimming whitespaces

  1. #1

    Trimming whitespaces

    Is there a way to trim whitespaces with LScript?

  2. #2
    It's been a long while since I used LScript, but looking at the docs it seems that there is no direct way of doing it, there is no trim function. However, a combination of strleft/strright and strsub should do the trick. I'm assuming we are talking about text strings...

  3. #3
    Yeah, that's what I've been doing. Was hoping for a better way.

  4. #4
    Super Member Kryslin's Avatar
    Join Date
    Feb 2009
    Prescott, IA
    <var>.pack() and <var>.trunc() should remove leading and trailing whitespace in lscript on strings.

    var a ="   This is a string with leadiing and trailing white space.   ";
    a = a.pack();
    a = a.trunc(); // a should now be "This is a string with leading and trailing white space."
    Last edited by Kryslin; 12-29-2017 at 08:17 PM.
    My Scripts for Lightwave
    Intel Core i7 960 @3.20 Ghz, 24 GB ram, EVGA 6GB GTX980Ti "Classified" driving 2 x HP LA2405.

  5. #5
    Nice! good to know.


Posting Permissions

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