Support Questions
Find answers, ask questions, and share your expertise

CASE CONVERSION

Highlighted

CASE CONVERSION

I have a string like "I want the reverse case for every LETTER in this string". I want to convert the case of the words in this string in a way that I get letters in lower case in upper case and vice versa.I want my output to read " i WANT THE REVERSE CASE FOR EVERY letter IN THIS STRING" . I want to do this using PIG and HIVE, both. Can I achieve it without using a UDF. Can somebody help me out here ?

2 REPLIES 2
Highlighted

Re: CASE CONVERSION

Doing without UDF and recombining them to form the String in the exact sequence will be very difficult.

Re: CASE CONVERSION

Super Guru

@Mrinmoy Choudhury

Pig has built in functions for converting case.

https://pig.apache.org/docs/r0.9.1/func.html#lower

https://pig.apache.org/docs/r0.9.1/func.html#upper

You will have to determine if a word is upper or lower case using something like "word == word.lower" or "word == word.upper" and then convert to what you desire.