如何在不使用预定义函数的情况下访问字符串的特定字符? [英] How to access particular character of a string without using pre defined functions?

查看:73
本文介绍了如何在不使用预定义函数的情况下访问字符串的特定字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何在不使用任何预定义函数(如charAt等)的情况下访问String的特定字符?由于java中没有指针,字符数组的概念被用作String ...所以有什么方法可以做到这一点吗?

I want to know how to access particular character of a String without using any pre defined functions(like charAt etc)? Since there are no pointers in java and the concept of character array being used as a String...So is there any way to do this?

推荐答案

没有。如果您不能使用String(或其他)类的任何方法,那么您无法确定任何字符是什么。


然后再次使用某些方法或另外,很难看出你可以做任何事情。
No. If you can''t use any of the methods of the String (or other) class then you can''t determine what any character is.

Then again without using some method or other, it''s hard to see that you can do anything at all.


字符串是不可变的所以它根本不会让你摆弄它的内部数据缓冲区,你有使用它为此目的提供的方法(例如charAt(...))。它根本不提供任何改变缓冲区的方法,你只能从缓冲区中读取。


亲切的问候,


Jos
Strings are immutable so it won''t let you fiddle with its internal data buffer at all, you have to use the methods it supplies for that purpose (such as charAt(...)). It doesn''t supply any methods for changing that buffer at all, you can only read from the buffer.

kind regards,

Jos


为什么要避免使用提供的方法?我认为这就是上课的重点。


要求永远不会令人惊讶。


问候,


Alex。
And why would you want to avoid the provided method? I thought that was the whole point of having the class.

Requirements never cease to amaze.

Regards,

Alex.


这篇关于如何在不使用预定义函数的情况下访问字符串的特定字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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