令牌功能在字符串类中

编程入门 行业动态 更新时间:2024-10-28 05:24:03
本文介绍了令牌功能在字符串类中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

Theres类的这个函数 void split(char token,String *&,int& ntokens); 它应该根据给定的标记拆分字符串并将所有子串存储在作为第二个参数传递的动态数组中,并在第三个参数中返回ntokens。 不幸的是,我既不理解问题的描述,也不理解函数的参数。帮助将不胜感激。 注意:我们不允许使用cstring函数。 我尝试了什么: 我不明白这个问题,因此,没试过。

Theres this function of a String class void split(char token, String *&, int &ntokens); And it should should split the string according to given token and store all substrings in a dynamic array passed as second argument, and return ntokens in third argument. Unfortunately, I don't understand the problem neither the description given as well as well as the arguments of the function. Help would be appreciated. Note: We are not allowed to use cstring functions. What I have tried: I don't understand the problem, therefore, haven't tried it.

推荐答案

您可以使用 strtok 开始实现您的功能[ ^ ]或编译器的任何适当版本,例如: strtok_s 函数参考页面底部有示例,可能有助于您了解如何使用它 you can begin implementing your function with strtok[^] or any appropriate version to your compiler , eg : strtok_s There is sample at the bottom of function reference page , that might help you to understand how to use it

更多推荐

令牌功能在字符串类中

本文发布于:2023-10-29 22:44:01,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1540981.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:令牌   字符串   类中   功能

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!