我发现这个任务在AS3中具有挑战性.
如果我遗漏了一些基本/简单或一些内置方法可以做到这一点,请原谅.我对RegExp并不熟悉.
我有一个动态表示其长相酷似"完整的文件路径字符串d:\ TEMP\abc.doc ".我想从完整的字符串中提取文件名部分,例如abc.doc.
我知道喜欢使用"fullPath.lastIndexOf(" \\")"或正则表达式技术.问题是,如果你的路径中有"\",它似乎不起作用.它适用于"/".无法操纵动态路径将"\"替换为"/"或任何其他分隔符.我的解释是,因为"\"用于转义字符 - 出现在"\"之后的任何字符都会被actionscript忽略.例如
var fullPath:String = "A\B\C";
trace(fullPath.length); //**RETURNS 3** since "\B" & "\C"
// are being treated as SINGLE chars
var bSlash:int = fullPath.lastIndexOf("\\") //RETURNS **-1**
Run Code Online (Sandbox Code Playgroud) double d;
scanf("%f", &d);
printf("%f", d);
Run Code Online (Sandbox Code Playgroud)
结果:
输入:10.3
输出:0.00000
为什么?我认为输出应该是10.3 visual studio 2008.
我在使用arraylist创建动态二维数组时发现了一些问题.原始代码读取繁琐冗长,所以我在这里给出一个简单的代码,在这两种情况下问题都是一样的:
import java.util.*;
class test{
public static void main(String args[]){
Integer test[]=new Integer[3];
ArrayList<Integer[]> al=new ArrayList<Integer[]>();
int i,t;
test[0]=1;
test[1]=2;
test[2]=3;
al.add(test);
test[0]=4;
test[1]=5;
test[2]=6;
al.add(test);
test[0]=7;
test[1]=8;
test[2]=9;
al.add(test);
test[0]=10;
test[1]=11;
test[2]=12;
al.add(test);
Integer table[][]=new Integer[al.size()][];
table=al.toArray(table);
for(i=0;i<=al.size()-1;i++){
for(t=0;t<3;t++){
System.out.print(" "+i+" "+t+" ");
System.out.print(" "+table[i][t]+" ");}
System.out.println();
}
}
}
Run Code Online (Sandbox Code Playgroud)
输出:
0 0 10 0 1 11 0 2 12
1 0 10 1 1 11 1 2 12
2 0 10 2 1 11 2 2 12
3 …Run Code Online (Sandbox Code Playgroud) char b;
operator<<(cout,(operator>>(cin,b)));
Run Code Online (Sandbox Code Playgroud)
这不是在vc ++中编译的,因为所有8个重载都无法转换此类型.
任何人都可以解释这个......
是返回类型的问题...........
我无法理解为什么这会抛出对"floor"的未定义引用 ":
double curr_time = (double)time(NULL);
return floor(curr_time);
Run Code Online (Sandbox Code Playgroud)
难道它没有被加倍,这是什么楼层收到?