fbpx
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: FileInfo:Stem?

FileInfo:Stem? 1 month 1 week ago #13275

  FFF's Avatar Topic Author FFF Offline Posts: 852
Probably i don't see the obvious, but i can't find an access to "FileInfo" for the "stem"-part of the path, i.e. for
D:\MyFile.txt
the "MyFile" part.
There's extension, directoryname, fullname, but no "stem" :(
Regards
Karl (X# 2.3b; Xide 1.24; W8.1/64 German)

Please Log in or Create an account to join the conversation.

Last edit: by FFF.

FileInfo:Stem? 1 month 1 week ago #13277

  wriedmann's Avatar wriedmann Away Posts: 2188
Hi Karl,
its seems so....
Maybe you have to write that yourself....
static method GetFilenameFromPath( cFullPath as string ) as string
	local nPos				as int
	local cReturn			as string

	if ( nPos := cFullPath:LastIndexOf( Path.DirectorySeparatorChar ) ) <= 0
		cReturn				:= cFullPath
	else
		if cFullPath:Length > ( nPos + 1 )
			cReturn				:= cFullPath:Substring( nPos + 1 )
		else
			cReturn				:= ""
		endif
	endif

	return cReturn
And then retrieve the extension, get the relative length and use only the left x characters.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy

www.riedmann.it - docs.xsharp.it

Please Log in or Create an account to join the conversation.

FileInfo:Stem? 1 month 1 week ago #13278

  robert's Avatar robert Offline Posts: 1540
Karl,

System.IO.Path.GetFileNameWithoutExtension()

Robert
XSharp Development Team
The Netherlands

Please Log in or Create an account to join the conversation.

FileInfo:Stem? 1 month 1 week ago #13281

  FFF's Avatar Topic Author FFF Offline Posts: 852
Robert,
thx, works. But why the didn't add the access, (using this call) is beyond me ;)
Regards
Karl (X# 2.3b; Xide 1.24; W8.1/64 German)

Please Log in or Create an account to join the conversation.

  • Page:
  • 1