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. my road
  2. my truck game --- help
  3. opening microsoft word document and microsoft powerpoint slides
  4. My Director has no Text Field
  5. Toggle Sound On/Off for AVI Video
  6. Keyboard Input Fails to Trigger Handlers
  7. Center Movie In A Window
  8. Microsoft Word Web Browser v1.0
  9. Sine Graph Function
  10. The coloured problems
  11. A Little fix or two
  12. Sine Reverse
  13. Repeatedly replacing Director bitmap
  14. Japanese characters in Director MX
  15. k-director.com: Post Updates
  16. A blog about Adobe Director
  17. Centerstage
  18. Custom Cursor...Why It Does Not Work?
  19. Director Game!
  20. cross platform
  21. database xtra for both mac and windows
  22. from windows to MAC
  23. SLIDER POSITION...
  24. Bullet points in text member
  25. Any VideoOut plugin / xtras for director mx ??
  26. Activex component install
  27. quiz
  28. how to export embedded flash swf?
  29. A BIG PROBLEM...
  30. Spining a model on a touchscreen
  31. 3D Fountain trail to avoid the Cursor
  32. HTTP
  33. SHOCKWAVE VIDEO
  34. Deleting Lines Comparing Time...I Have No Idea...
  35. Property not found error
  36. SHOCKWAVE PROBLEM
  37. PROBLEM SHOCKWAVE
  38. text field focus
  39. ExitLock CloseRequest Quit Close Gadget
  40. convert read only
  41. F10 Key Code Does Not Work
  42. Director Game Development Survey
  43. baPrintFile()
  44. How do check if a printer is printing??

Useful Links

Google Translate
AltaVista Translate
Google Glossary

Google
Web www.domaj.com

EZ BAS Easy BAS.

Save hours of work on your Business Activity Statement using this simple, quick and efficient product.