Quality Testing

Quality is delighting customers

Hi All,
This is Interview question asked to me in Oracle.String reverse
Ex: "Oracle Information System" is the stringWithout using String functions. It should display as"System Information Oracle".
Thanks in Advance

Views: 585

Reply to This

Replies to This Discussion

Hi,

 

Try with below code.

 

Dim str

str = "Oracle Information System"

Arrstr = split(str, " ")

for i = ubound(Arrstr) to lbound(Arrstr) step -1

    strrev = strrev & Arrstr(i) & " "

next

msgbox strrev

 

Regards,

Suma

Thank You Suma.

Without using String functions.

Hi Suma,

   His question is with out using any string functions.you used split(),I think its a string function.As per query we should not use any string function rt?Can u give some clarity on this?

 

Thanks,

Suresh

Yes Suresh, you are right

y = Len(MyStr)
For x = y To 1 Step -1
     char = Mid(MyStr,x,1)  ' ths statement will take the one character from the string from last character                                                     to first character
     NewStr = NewStr & char  ' add above separated character to string 
Next

 

msgbox newStr

Hi,

 

Suma has given correct answer, split is not string function, split is array function.

 

Here i attached string functions and array functions. pls find out attachments

Attachments:

Hi Vijay,

  As per my knowledge split is a string function.It returns a 1-dimensional array of sub strings, does not mean its a array function.we will pass string as an argument and it returns substrings also referred as 1-dimensional arrays.In some portals I found it as array function too and in some as string function,so still looking for more clarification.

 

Thanks,

Suresh

Thank you Raghuraman

USING PERL :

 

$str="Oracle Information System";
@arr=split(" ",$str);
foreach(@arr){
  unshift(@myNames, $_);

}

$str=join(" ",@myNames);

print $str;

Thank you Lalit.

 

 

RSS

TTWT Magazine


Advertisement

Advertisement

Advertisement

Advertisement

© 2022   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service