如何检查NSString是否以某个字符(字符*)开头.
*是单元格类型的指示符,所以我需要没有*的NSString的内容,但需要知道*是否存在.
我正在使用以下方法手动创建数据结构:
NSDictionary* league1 = [[NSDictionary alloc] initWithObjectsAndKeys: @"Barclays Premier League", @"name",
@"Premier League", @"shortname",
@"101", @"id", nil];
NSDictionary* league2 = [[NSDictionary alloc] initWithObjectsAndKeys: @"Coca-Cola Championship", @"name",
@"Championship", @"shortname",
@"102", @"id", nil];
NSDictionary* league3 = [[NSDictionary alloc] initWithObjectsAndKeys: @"Scottish Premier League", @"name",
@"SPL", @"shortname",
@"201", @"id", nil];
NSDictionary* league4 = [[NSDictionary alloc] initWithObjectsAndKeys: @"Champions League", @"name",
@"UCL", @"shortname",
@"501", @"id", nil];
contentArray = [[NSArray alloc] initWithObjects:
[[NSDictionary alloc] initWithObjectsAndKeys: @"English", @"category", [[NSArray alloc] initWithObjects: league1, league2, nil], @"leagues", nil],
[[NSDictionary alloc] …Run Code Online (Sandbox Code Playgroud) 我试图添加一些过滤到应用程序上下文文件,该文件驻留在WEB-INF目录中.
我在文件夹/ src/main/resources中有要过滤的文件(xmlgateway-context.xml).
我在文件夹src/main/filters中有属性文件(config-e05.properties)
我的POM设置如下:
<!-- environment profiles -->
<profiles>
<profile>
<id>e04</id>
<properties>
<targetenv>e04</targetenv>
</properties>
</profile>
<profile>
<id>e05</id>
<properties>
<targetenv>e05</targetenv>
</properties>
</profile>
</profiles>
<!-- build settings (filtering) -->
<build>
<filters>
<filter>src/main/filters/config-${targetenv}.properties</filter>
</filters>
<resources>
<resource>
<targetPath>WEB-INF</targetPath>
<filtering>true</filtering>
<directory>src/main/resources</directory>
</resource>
</resources>
</build>
Run Code Online (Sandbox Code Playgroud)
这将正确安装mvn,但是当我打开输出war文件时,我希望文件xmlgateway-context.xml位于/ WEB-INF目录中,但它最终位于/ WEB-INF/classes/WEB文件夹中-INF.
如何将此文件放到正确的位置.
或者,我可以将应用程序上下文放在不同的位置并在那里引用它.
我尝试了很多Perl XML Parsers.我对Sablotron Parser很感兴趣,但安装在Windows机箱上真是太痛苦了.目前我已经开始使用XML :: LibXML和XML :: LibXSLT这两者似乎都做我需要的一切.
它们似乎也很标准.是否有比这更好的XML解析器?
有没有办法循环打开窗户.当我想在另一个文件中引用某些东西时,我经常使用它.在Windows上,这通常是Ctrl+ Tab,但我找不到在Mac上的Xcode中执行此操作的方法.
我需要使用Perl中的正则表达式匹配并删除所有标记.我有以下内容:
<\\??(?!p).+?>
Run Code Online (Sandbox Code Playgroud)
但这仍然与结束</p>标签相匹配.关于如何与结束标签匹配的任何提示?
注意,这是在xhtml上执行的.
我正在使用OpenJDK 1.8编写Maven应用程序并使用TestNG运行测试.
当我从命令行运行Maven时一切正常,但是当我尝试在IntelliJ中运行测试时,make进程显示以下错误:
java: javacTask: source release 8 requires target release 1.8
Run Code Online (Sandbox Code Playgroud)
我的项目设置指向1.8 JDK和Project Language Level 8.
在Maven内部我有以下块(我猜测它还没有被调用,因为它似乎是造成问题的原因)
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
我甚至将Maven Runner JRE配置为指向1.8 JDK.
我似乎无法让IntelliJ 12.0.4正确运行测试
我错过了什么吗?
如何将字体设置为粗体和斜体.有一个boldSystemFontOfSize和italicSystemFoneOfSize,但我看不到将字体设置为斜体和粗体的方法.
作为第二个问题,有没有办法在字体上设置下划线,或者只是在文本下画一条线.
是否有方法在矩形的中间绘制文本.我可以找到各种对齐方式,但我尝试过的任何内容都不能将文本垂直居中.
有没有一种简单的方法可以做到这一点,或者是否有某种方法可以使矩形居中然后绘制?
我正在直接绘制CGContext,尝试使用NSString :: drawWithRect或类似的东西,因为我真的不想添加一个Label来呈现一些基本文本.
我已tableView:indentationLevelForRowAtIndexPath在我的UITableViewController派生类中重写了该方法,如下所示:
- (NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath {
NSDictionary* item = [self.projects objectAtIndex:indexPath.row];
int indentationLevel = [[item objectForKey:@"indent"] intValue];
DLog (@"Indentation Level for Row %d : %d", indexPath.row, indentationLevel);
return indentationLevel;
}
Run Code Online (Sandbox Code Playgroud)
我最初认为这没有被调用,但这是操作员错误(错误,我的),我没有定义符号DEBUG = 1.
然而,它被称为(对我!),这是日志输出:
-[RootViewController tableView:indentationLevelForRowAtIndexPath:] [Line 129] Indentation Level for Row 0 : 1
-[RootViewController tableView:indentationLevelForRowAtIndexPath:] [Line 129] Indentation Level for Row 1 : 1
-[RootViewController tableView:indentationLevelForRowAtIndexPath:] [Line 129] Indentation Level for Row 2 : 2
-[RootViewController tableView:indentationLevelForRowAtIndexPath:] [Line 129] Indentation Level for Row …Run Code Online (Sandbox Code Playgroud)