How do I change the case of a string using the “:substitute”

command? You can use special characters in the replacement string for a “:substitute” command to change the case of the matched string. For example, to change the case of the string “MyString” to all uppercase, you can use the following command:

    :%s/MyString/\U&/g

To change the case to lowercase, you can use the following command:

    :%s/MyString/\L&/g

To change the case of the first character in all the words in the current line to uppercase, you can use the following command:

    :s/\<\(.\)\(\k*\)\>/\u\1\L\2/g

Read free Software Algorithms and Computer Science Books by CodeAhoy Learn.

Introduction to Recursion and Backtracking

Sorting Algorithms

Introduction to C Programming Language

And More...

Speak Your Mind