我必须在C#中完成一个项目才能找到每个java类的方法数量。
我可以使用c#正则表达式在.java文件中找到所有方法,但是我想要的是查找每个类(包括内部类)的方法数量。谁能帮我。
string[] lines = File.ReadAllLines(file);
int countLine = 0;
int AllCount = 0;
foreach (string line in lines)
{
countLine = MethodsCount(line);
AllCount = AllCount + countLine;
}
label5.Text = AllCount.ToString();
Run Code Online (Sandbox Code Playgroud)
这是方法计数方法。
private int MethodsCount (string LineOperator)
{
int count = 0;
string[] words = LineOperator.Split('{');
foreach (string word in words)
{
if (Regex.IsMatch(word, @"(static\s|final\s)?(public|private|internal)(\sstatic|\sfinal)?\s(int|boolean|void|double|String|long|String\[\]|String\[\]\[\])?\s([a-z]|[A-Z]+[a-z]+|[a-z]+[A-Z]+)+(\s)*\((\s|\n|\r)*"))
{
count = count + 1;
}
}
return count;
}
Run Code Online (Sandbox Code Playgroud)
如果我们考虑一堂课
public class vehicle {
public method1() {
---------
}
public method2() { …
Run Code Online (Sandbox Code Playgroud) 我想在 mac 中创建一个 fat 库。所以我就遵循这个。我将 makefile 的内容复制到编辑文本中并将其重命名为Makefile.mak
. 我打开了 makefile 所在的终端,并在终端中键入“make”并按 Enter 键。我收到错误“找不到 Makefile”。这会是什么原因呢?我哪里做错了?请帮我。谢谢
我有一个简单的Android代码,通过Web服务定期发送GPS位置到数据库.出于测试目的,我将minTime设置为2000ms.
lm=(LocationManager)getSystemService(Context.LOCATION_SERVICE);
ll=new SpeedoActionListener();
lm.requestLocationUpdates(LocationManager.GPS_PROVIDER,2000, 0,ll);
Run Code Online (Sandbox Code Playgroud)
但...
网络服务托管在IIS7上,我的手机和笔记本电脑通过Wi-Fi连接
虽然我的手机没有移动,为什么它会发送不同的位置?
private class SpeedoActionListener implements LocationListener
{
String result=null;
@Override
public void onLocationChanged(Location location) {
if(location!=null) {
lati=location.getLatitude();
longi=location.getLongitude();
String mylati=Double.toString(lati);
String mylongi=Double.toString(longi);
WebServiceCaller obj=new WebServiceCaller();
result=obj.sendLocationData(mylongi, mylati);
resultText=(TextView)findViewById(R.id.result);
resultText.setText(result);
}
}
@Override
public void onProviderDisabled(String provider) {
// TODO Auto-generated method stub
}
@Override
public void onProviderEnabled(String provider) {
// TODO Auto-generated method stub
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
// TODO Auto-generated method …
Run Code Online (Sandbox Code Playgroud) 我想将attributesstring设置为my UILabel
.所以我用这种方式定义了属性.
let attribute1:[String:Any]=[
NSForegroundColorAttributeName: UIColor.init(colorLiteralRed: 120.0/255, green: 173.0/255, blue: 194.0/255, alpha: 1.0),
NSFontAttributeName:UIFont.init(name: "Bariol_Bold", size: 15.0)!]
let attributedStringGreeting=NSAttributedString.init(string: welcomeMessage, attributes: attribute1)
Run Code Online (Sandbox Code Playgroud)
但我收到这个错误:
NSFontAttributeName:UIFont.init(name: "Bariol_Bold", size: 15.0)!]
Run Code Online (Sandbox Code Playgroud)
这是否意味着我的自定义字体没有采取?但是,当我从IB中设置字体时,它会显示出来.
致命错误:在展开Optional值时意外发现nil
我该如何解决这个问题?请帮我.
我正在 iOS 上创建一个 AR 应用程序,它可以定义一些带有一些注释的锚点并将它们保存在云中。后来我想使用任何设备(iOS 或 Android)检索这些锚点并将它们显示在 ARView 中。我知道我们可以只使用 ARKit 来定义锚点。我们也可以使用 Azure 空间锚点。
我的感觉是,因为我跨平台使用锚点,所以我应该使用 Azure 空间锚点。但是我想知道这两种类型的锚点之间的确切区别是什么。是否可以仅使用 ARKit 锚点并在 Android 设备上准确呈现?简单地说,我想知道根据我的情况什么是最好的解决方案。
如何编写正则表达式来获取python中的浮点数.我想得到55.97.来自<td nowrap="nowrap">55.97</td>
.所以我给了
newsecond_row_data = (re.search('(?<=>)\d+|\d+.\d+',second_row_data[a]))
newsecond_row_data.group(0)
print newsecond_row_data.group(0)
Run Code Online (Sandbox Code Playgroud)
但它给了55而不是55.97.Plz hlp我
谢谢