我想将react-router包升级到v6. 它对包有依赖性history,在history包路线图中,文档说history.length很快就会被弃用甚至删除。你可以看一下https://github.com/remix-run/history/issues/689
我想知道在将包升级到最新版本时是否有其他替代方案可以history.length在我的代码中使用。react-router
举个例子,我的用法之一:
import { useHistory } from 'react-router';
const history = useHistory();
const onGoBack = () => {
if (history.length > 2) {
history.goBack();
} else {
history.push('/portfolio');
}
};
Run Code Online (Sandbox Code Playgroud) 我希望使用文件操作在C中的链表.我想得到一条线并将其拆分并存储在结构中.但我不能分裂两个字符串.
我的文件是这样的:
1#Emre #Dogan
2#John#Smith
3#Ashley #Thomas
等...
我想使用fscanf从文件中读取一行.
fscanf(file,"%d#%s#%s",&number,name,surmane);
Run Code Online (Sandbox Code Playgroud)
但结果是
编号:1
姓名:Emre #Dogan
如何摆脱名称中的#元素并将其拆分为姓名和姓氏;