Skip to content

Commit

Permalink
Strings
Browse files Browse the repository at this point in the history
  • Loading branch information
Prateek Bhaisora authored and Prateek Bhaisora committed Jan 23, 2024
1 parent df94b25 commit 86cd92a
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions 07_string_ops.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

myVar="Hey Buddy, how are you?"

myVarLength=${#myVar}
echo "Length of myVar is $myVarLength"

#LowerCase and UpperCase

echo "Upper case is: ${myVar^^}"
echo Lower case is: ${myVar,,}

# Replacement

newVar=${myVar/Buddy/Bob}
echo "New variable is: $newVar"

# Slicing

echo "Sliced string is: ${myVar:4:5}"

0 comments on commit 86cd92a

Please sign in to comment.