HOME  FORUM  LINKS

Site Menu

Development

Director

Hosting Support

Quick Links

Director Code Snippets

Some useful functions and code snippets for use in your Director Lingo programming.

Strip a character from a string

Usage: var=Strip(Source_String, Character_to_Strip)

on strip theString, theCharacter
  --put the paramcount
  if theString = void or the paramCount<> 2 then
    put "usage: strip(theSting, theCharacter)"
    exit
  end if
  theLength = length(theString)
  retString = ""
  repeat with i = 1 to thelength
    if theString.char[i] <> theCharacter then
      put theString.char[i] after retString
    end if
  end repeat
  return retString
end

Left string function

Return the left n characters of a string

Usage: var=LeftStr(Source_String, Number_of_characters)

on leftStr theString, howmany
  if theString = void then
    put "usage: leftStr(theSting, howmany)"
    exit
  end if
  theLength = length(theString)
  if howMany > theLength then
    howMany = theLength
  end if
  return theString.char[1..howmany]
end

Right string function

Return the right n characters of a string

Usage: var=rightStr(Source_String, Number_of_characters)

on rightStr theString, howmany
  if theString = void then
    put "usage: rightStr(theSting, howmany)"
    exit
  end if
  theLength = length(theString)
  if howMany > theLength then
    howMany = theLength
  end if
  return theString.char[howmany..theLength]
end

Mid string function

Returns a substring from a string, given the starting offset and the number of characters.

Usage: var=midStr(Source_String, startOffset, Number_of_characters)

on midStr theString, start, howmany
  if theString = void then
    put "usage: midStr(theSting, start, howmany)"
    exit
  end if
  theLength = length(theString)
  endPoint = start + howmany
  if endPoint > theLength then
    endPoint = theLength
  end if
  a=theString.char[start..endPoint]
  return a
end

DOMAJ LINKS


Recent Topics

The latest topics from the forum.

  1. k-director.com: Post Updates
  2. A blog about Adobe Director
  3. Centerstage
  4. Custom Cursor...Why It Does Not Work?
  5. Director Game!
  6. cross platform
  7. database xtra for both mac and windows
  8. from windows to MAC
  9. SLIDER POSITION...
  10. Bullet points in text member
  11. Any VideoOut plugin / xtras for director mx ??
  12. Activex component install
  13. quiz
  14. how to export embedded flash swf?
  15. A BIG PROBLEM...
  16. Spining a model on a touchscreen
  17. 3D Fountain trail to avoid the Cursor
  18. HTTP
  19. SHOCKWAVE VIDEO
  20. Deleting Lines Comparing Time...I Have No Idea...
  21. Property not found error
  22. SHOCKWAVE PROBLEM
  23. PROBLEM SHOCKWAVE
  24. text field focus
  25. ExitLock CloseRequest Quit Close Gadget
  26. convert read only
  27. F10 Key Code Does Not Work
  28. Director Game Development Survey
  29. baPrintFile()
  30. How do check if a printer is printing??

Useful Links

Google Translate
AltaVista Translate
Google Glossary

Google
Web www.domaj.com