STRCHR与STRRCHR有何区别? [英] STRCHR vs STRRCHR difference?

查看:212
本文介绍了STRCHR与STRRCHR有何区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道两种不同用途之间的区别. 我相信某些差异非常微妙.

I would like to know the difference between the two different uses. I believe the difference in some what very subtle.

这是从IBM参考手册中获得的说明. 但是也许我的英语不好,我只是看不到区别.

This is an explanation taken from the IBM reference manual. However maybe my english is bad, I just can't visualize the difference.

也许给我看两个案例的例子,可以帮助我更好地理解这一点.

Maybe showing me an example of both cases would help me understand this better.

这是IBM的解释:

strchr子例程返回一个指针,该指针指向由String参数指向的字符串中的Character (转换为无符号字符)参数指定的字符的首次出现.如果字符没有出现在字符串中,则返回一个空指针.终止字符串的空字节被视为字符串的一部分.

The strchr subroutine returns a pointer to the first occurrence of the character specified by the Character (converted to an unsigned character) parameter in the string pointed to by the String parameter. A null pointer is returned if the character does not occur in the string. The null byte that terminates a string is considered to be part of the string.

strrchr子例程返回一个指针,该指针指向由String参数指向的字符串中的Character (转换为字符)参数指定的字符的最后一次出现.如果字符没有出现在字符串中,则返回一个空指针.终止字符串的空字节被视为字符串的一部分.

The strrchr subroutine returns a pointer to the last occurrence of the character specified by the Character (converted to a character) parameter in the string pointed to by the String parameter. A null pointer is returned if the character does not occur in the string. The null byte that terminates a string is considered to be part of the string.

推荐答案

strchr strstr :

第一个(包括第一个)开始返回干草堆字符串的一部分 发生在大海捞针末端的情况.

Returns part of haystack string starting from and including the first occurrence of needle to the end of haystack.

strrchr :

此函数返回从 last开始的干草堆部分 发生,直到大海捞针结束.

This function returns the portion of haystack which starts at the last occurrence of needle and goes until the end of haystack.

strchr从第一次出现开始,strrchr从最后一次出现开始.

strchr starts at the first occurrence, strrchr starts at the last occurrence.

这篇关于STRCHR与STRRCHR有何区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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