Posted: 25th Dec 2003 12:23
Returns the extension of a string. (for a file)

If you have a string like "this.is.really.dumb", it'll return "dumb".

+ Code Snippet
function getFtpExtension(name$ as string)
  length = len(name$)
  i = length
  while (mid$(name$, i) <> ".")
      dec i
  endwhile
  ext$ = right$(name$, length - i)
endfunction ext$
Posted: 26th Dec 2003 0:41
cool Phaelax!
Posted: 26th Dec 2003 2:14
Wow, how did you do that????
I don't understand anything, but it works!!!!!!!!!!
Posted: 26th Dec 2003 22:57
it's easy to understand, where's the difficulty ?
it reads the name, but it begins from the end ; it continue to read until the letter is "." => all the others letters it has read are the format

but I think you should add something, Phaelax, because your code may crash the application

+ Code Snippet
function getFtpExtension(name$ as string)
  length = len(name$)
  i = length
  while (mid$(name$, i) <> ".") or i>0
      dec i
  endwhile
  if i>0 then ext$ = right$(name$, length - i) else ext$=""
endfunction ext$


so, if there isn't any . in your file, the code won't crash
Posted: 27th Dec 2003 22:19
it's easy to understand, where's the difficulty ?
it reads the name, but it begins from the end ; it continue to read until the letter is "." => all the others letters it has read are the format

Maybe it was a joke...
Posted: 29th Dec 2003 7:18
no, i realized that, but was too lazy to put in the extra check.

[Edit 3 1/2 years later]
That comment makes me sound like a noob