小编olg*_*sta的帖子

如何替换类似的西里尔字母和英文字符

我有一个文本框,用户可以用Java输入带字母和数字的字符串,即

String inputString ="Аs87df56VСХ6ВР";

并且用户可能忘记切换语言并使用西里尔字母输入此字符串,因为在西里尔字母和英文字母中有类似的字符:ABCEHKMOPTX

我的问题是:如何在输入字符串中查找和替换西里尔字母?

java string

5
推荐指数
1
解决办法
1637
查看次数

在Eclipse中构建期间无法初始化模块TreeWalker

我在Eclipse Mars中执行Project-Clean ...并收到以下错误

   Errors occurred during the build.
     Errors running builder 'Checkstyle Builder' on project 'MyProject'.
        cannot initialize module TreeWalker - Unable to instantiate 
        'RedundantThrows' class, it is also not possible to instantiate it as 
        com.puppycrawl.tools.checkstyle.checks.annotation.RedundantThrows, 
        com.puppycrawl.tools.checkstyle.checks.blocks.RedundantThrows, 
        com.puppycrawl.tools.checkstyle.checks.coding.RedundantThrows, 
        com.puppycrawl.tools.checkstyle.checks.design.RedundantThrows, 
        com.puppycrawl.tools.checkstyle.checks.header.RedundantThrows, 
        com.puppycrawl.tools.checkstyle.checks.imports.RedundantThrows, 
        com.puppycrawl.tools.checkstyle.checks.indentation.RedundantThrows, 
        com.puppycrawl.tools.checkstyle.checks.javadoc.RedundantThrows, 
        com.puppycrawl.tools.checkstyle.checks.metrics.RedundantThrows, 
        com.puppycrawl.tools.checkstyle.checks.modifier.RedundantThrows,
        com.puppycrawl.tools.checkstyle.checks.naming.RedundantThrows, 
        com.puppycrawl.tools.checkstyle.checks.regexp.RedundantThrows,
        com.puppycrawl.tools.checkstyle.checks.sizes.RedundantThrows, 
        com.puppycrawl.tools.checkstyle.checks.whitespace.RedundantThrows, 
        com.puppycrawl.tools.checkstyle.checks.RedundantThrows, 
        com.puppycrawl.tools.checkstyle.filters.RedundantThrows, 
        com.puppycrawl.tools.checkstyle.RedundantThrows. Please recheck that class name 
        is specified as canonical name or read how to configure short name usage 
        http://checkstyle.sourceforge.net/config.html#Packages. Please also recheck that 
        provided ClassLoader to Checker is …
Run Code Online (Sandbox Code Playgroud)

eclipse checkstyle

5
推荐指数
1
解决办法
8759
查看次数

类型错误:无法读取未定义的属性(读取“匹配”)

我已将 Angular 应用程序从 12 版本升级到 13 版本。我在单元测试运行期间开始收到此错误。

Chrome Headless 94.0.4606.61 (Windows 10) AppComponent should create the app FAILED
        TypeError: Cannot read properties of undefined (reading 'match')
            at extractCommentsWithHash (http:###/_karma_webpack_/webpack:/node_modules/@angular/compiler/fesm2020/compiler.mjs:9130:18)
            at ShadowCss.shimCssText (http:###/_karma_webpack_/webpack:/node_modules/@angular/compiler/fesm2020/compiler.mjs:8694:34)
            at map (http:###/_karma_webpack_/webpack:/node_modules/@angular/compiler/fesm2020/compiler.mjs:22402:26)
            at Array.map (<anonymous>)
            at compileStyles (http:###/_karma_webpack_/webpack:/node_modules/@angular/compiler/fesm2020/compiler.mjs:22401:19)
            at compileComponentFromMetadata (http:###/_karma_webpack_/webpack:/node_modules/@angular/compiler/fesm2020/compiler.mjs:21948:13)
            at CompilerFacadeImpl.compileComponentFromMeta (http:###/_karma_webpack_/webpack:/node_modules/@angular/compiler/fesm2020/compiler.mjs:22570:21)
            at CompilerFacadeImpl.compileComponent (http:###/_karma_webpack_/webpack:/node_modules/@angular/compiler/fesm2020/compiler.mjs:22560:21)
            at Function.get (http:###/_karma_webpack_/webpack:/node_modules/@angular/core/fesm2020/core.mjs:24583:47)
            at getComponentDef (http:###/_karma_webpack_/webpack:/node_modules/@angular/core/fesm2020/core.mjs:1119:16)
        Failed: Cannot read properties of undefined (reading 'match')
Run Code Online (Sandbox Code Playgroud)

我尝试了这个解决方案,但没有成功。

manually remove package-lock.json
manually remove folder node_modules
npm install
Run Code Online (Sandbox Code Playgroud)

您有任何解决办法吗?与 Angular 版本升级有关吗?

npm angular angular12 angular13

3
推荐指数
1
解决办法
4万
查看次数

Jasmine.createSpy 相当于玩笑

我正在我的应用程序中从 jasmine 迁移到 jest。我有以下行要测试

JSON.parse(window.document.querySelector(SELECTOR).innerHTML)
Run Code Online (Sandbox Code Playgroud)

在我的测试中我使用了茉莉花。

document.querySelector = jasmine.createSpy('HTML Element').and.returnValue(dummyEl)
Run Code Online (Sandbox Code Playgroud)

但现在开玩笑我收到以下错误

TypeError: Cannot read property 'innerHTML' of null
Run Code Online (Sandbox Code Playgroud)

你能帮助我吗?

jasmine jestjs

2
推荐指数
1
解决办法
5698
查看次数

标签 统计

angular ×1

angular12 ×1

angular13 ×1

checkstyle ×1

eclipse ×1

jasmine ×1

java ×1

jestjs ×1

npm ×1

string ×1