不使用内置库反转字符串中的每个单词. [英] Reverse each word of a string with out using built in libraries.

查看:77
本文介绍了不使用内置库反转字符串中的每个单词.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我在HCL中遇到了一个问题,他们要求我不使用内置函数,长度(不超过一个for循环,计数变量)来反转字符串的每个单词.

字符串"Google Android Programming Net"的示例.

输出:"elgooG diordnA gnimmargorP teN"

凸轮有没有人告诉我这可能吗?如果是这样的解决方案?

Hi
I have faced one question in HCL that they have asked me to reverse each word of string with out using built in functions,length, not more than one for loop, count variables.

Ex of string "Google Android Programming Net".

Output: "elgooG diordnA gnimmargorP teN"

Cam any body tell me is it possible? If so solution?

推荐答案

您可以按照
You can do this by using the XOR operator as described here[^].
Only one function, ToCharArray has been used in the sample.


我不希望为您提供确切的代码,因为您会失去所有有趣的部分.

尝试使用下面的String方法来解决它.

String.Split方法


String.ToCharArray方法
I would not prefer to provide you exact code becuase then you will loose all fun part of it.

Try to use below String Methods to solve it.

String.Split Method


String.ToCharArray Method


这篇关于不使用内置库反转字符串中的每个单词.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆