Added string length example

This commit is contained in:
Martin Nicholson 2018-01-16 15:31:32 +00:00
parent f39df1da09
commit 462f94b967

View File

@ -77,8 +77,11 @@ echo ${Variable/Some/A} # => A string
Length=7
echo ${Variable:0:Length} # => Some st
# This will return only the first 7 characters of the value
echo ${Variable: -Length}
# This will return the last 7 characters (note the space before -Length)
echo ${Variable: -5} # => tring
# This will return the last 5 characters (note the space before -5)
# String length
echo ${#Variable} # => 11
# Default value for variable
echo ${Foo:-"DefaultValueIfFooIsMissingOrEmpty"}