Search code examples
basic4android

truncating a file name - extension


I have a file being loaded into fd.ChosenName and wondering if there is a quick solution such as an opposite to stringbuilder to truncate a file name (extension) for display purposes. So if the value of fd.ChosenName is picture1.jpg I could actually display the text picture1 in a panel etc.


Solution

  • str.SubString2(0, str.LastIndexOf("."))
    

    Edited for correct answer

    SubString2 takes 2 parameters, beginIndex and endIndex

    Reference: http://www.basic4ppc.com/android/help/core.html#string