Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2005
    Posts
    103

    Help with some String splicing

    I have this code:

    titlelength = String.Length(tblTag.Title);
    if titlelength > 17 then
    trimamount = titlelength - 14;
    tblTag.Title = String.TrimRight(tblTag.Title, trimamount);
    tblTag.Title = tblTag.Title.."..."
    end
    My goal is to get any name longer than 17 characters to fit in the given box. I'm trying to get it to rename things like, for instance, this Evanescence song:

    Bring Me to Life (demo) by Evanescence
    I would like to be:
    Bring Me to Li...by Evanescence
    My code doesn't seem to be doing it properly, and I'm not sure what I did wrong. Any ideas?

  2. #2
    Join Date
    Mar 2005
    Posts
    103
    Edit: I think I figured it out.

  3. #3
    Join Date
    May 2006
    Posts
    5,380
    use String.Mid to trim the string


    PHP Code:
    LongString Input.GetText("Input1");
    StringLenth String.Length(LongString);
    if 
    StringLenth 18 then--adjust the number you want to trim
    LeftString 
    String.Mid(LongString19);--adjust the number you want to trim
    RightString 
    String.Mid(LongStringStringLenth-9StringLenth);--adjust the number you want to trim
    ShortString 
    LeftString.."..."..RightString
    Input
    .SetText("Input2"ShortString);
    end 
    attachment shows it working


    EDIT:

    Edit: I think I figured it out.
    Nice Job
    Last edited by RizlaUK; 02-01-2009 at 11:35 AM.
    Open your eyes to Narcissism, Don't let her destroy your life!!

Similar Threads

  1. Jukebox Enhancements
    By Zylo in forum AutoPlay Media Studio 6.0
    Replies: 2
    Last Post: 01-13-2007, 07:39 PM
  2. table to string
    By ZenLunatic in forum AutoPlay Media Studio 6.0
    Replies: 8
    Last Post: 09-26-2006, 11:49 AM
  3. Replies: 19
    Last Post: 05-23-2006, 11:40 AM
  4. attempt to index a string value
    By csd214 in forum AutoPlay Media Studio 5.0
    Replies: 8
    Last Post: 08-08-2004, 01:23 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