Skip to content

getFilePathLevel

Requires a Node.js runtime ('qsu/node')

Determine how many steps the current path is. The root path (/ or C:\) begins with step 1.

Parameters

  • filePath::string

Returns

string

Examples

javascript
// Include 'C:\' root path
getFilePathLevel('C:\\Windows\\System32'); // 3
// Include '/' root path
getFilePathLevel('/home/user'); // 3
dart
// Include 'C:\' root path
getFilePathLevel('C:\\Windows\\System32'); // 3
// Include '/' root path
getFilePathLevel('/home/user'); // 3
python
# Include 'C:\' root path
getFilePathLevel('C:\\Windows\\System32') # 3
# Include '/' root path
getFilePathLevel('/home/user') # 3

Released under the MIT License