我尝试用iText7 hyphenation连字符串。
我使用了示例代码,但它返回null而不是带连字符的String或Hyphenation对象:
fun actionBarIcon(imageName:Int) {
setSupportActionBar(findViewById(R.id.my_toolbar))
my_toolbar.setLogo(imageName)
/*
What is to be done to solve the issue:-
Below code is setting up title to fff if only the condition is met. but there you have not set any title if condition is not met so by default it is picking up app name.
So, give a default value when activity is visible. Either provide title to toolbar in layout or use
// Set toolbar title/app title
my_toolbar!!.title = "fff"
*/
if (imageName == R.drawable.ic_title_black) my_toolbar.setTitle("fff")
if (imageName == R.drawable.logged) my_toolbar.setTitle(getCurrentNumber())
if (imageName == R.drawable.tutorial) my_toolbar.setTitle("Tutorial")
}
我从pom.xml获取的内容是:
Hyphenator h = new Hyphenator("de", "DE", 2, 2);
Hyphenation s = h.hyphenate("Leistungsscheinziffer");
System.out.println(s);//this is null and not "Lei-stungs-schein-zif-fer"
有没有我忘了配置?
感谢您帮助我解决此问题。 :)
答案 0 :(得分:1)
您有hyph
作为test
依赖关系(请参阅<scope>
)。这意味着,只有在运行测试时才会添加它。如果要在非测试环境中使用hyph
,请确保依赖性为例如compile
(默认为compile
):
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>hyph</artifactId>
<version>7.1.2</version>
</dependency>