我知道我可以通过一系列for循环遍历字符串来实现这一点,但那将是糟糕的编程.好吧,我的教授更喜欢我不这样做.我想使用正则表达式来做到这一点.
语言是javascript。
将通过的字符串:
JavaScript1*
Pu54 325
()9c
无法通过的字符串:
654fff
%^(dFE
我尝试了以下方法:
var matches = password.match(/\d+/g);
if(matches != null)
{
//password contains a number
//check to see if string contains a letter
if(password.match(/[a-z]/i))
{
//string contains a letter and a number
}
}
Run Code Online (Sandbox Code Playgroud) 我喜欢使用eclipse氧气进行java开发.我大约一年没用过这个IDE了.我记得真的很喜欢它.但是,我记得它不是最容易安装的IDE.任何帮助将不胜感激.
这是我安装的java.
我不知道发生了什么事.请随意建议另一个IDE.
这是日志文件:
!SESSION 2017-09-22 11:44:55.501 -----------------------------------------------
eclipse.buildId=4.7.0.I20170612-0950
java.version=9
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments: -product org.eclipse.epp.package.java.product
Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.java.product
!ENTRY org.eclipse.osgi 4 0 2017-09-22 11:45:10.776
!MESSAGE Application error
!STACK 1
org.eclipse.e4.core.di.InjectionException: java.lang.NoClassDefFoundError: javax/annotation/PostConstruct
at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:410)
at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:318)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:162)
at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createDefaultHeadlessContext(E4Application.java:491)
at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createDefaultContext(E4Application.java:505)
at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createE4Workbench(E4Application.java:204)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:614)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:594)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:151)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388) …Run Code Online (Sandbox Code Playgroud) 我正在为那些希望将他们的JavaScript库组织成类别的人工作:CRUD函数,表单函数等.他们非常喜欢C#中的区域实用程序,并且在他们的JavaScript文件中要求这样做.有什么建议?我正在使用Visual Studio 2017和Team Foundation Server.
这是我一直在研究的第二个SML程序.这些函数是相互递归的.如果我称奇数(1)我应该变为真,甚至(1)我应该变得虚假.这些函数应适用于所有正整数.但是,当我运行这个程序时:
fun
odd (n) = if n=0 then false else even (n-1);
and
even (n) = if n=0 then true else odd (n-1);
Run Code Online (Sandbox Code Playgroud)
我明白了:
[opening test.sml]
test.sml:2.35-2.39 Error: unbound variable or constructor: even
val it = () : unit
Run Code Online (Sandbox Code Playgroud)
我怎样才能解决这个问题?
我已经被这个问题难住了一段时间了。我什至在网上找不到类似的场景。我有一个来自教授的 HTML 文件,浏览器将其解释为纯文本。有人能告诉我为什么吗?
浏览器:Google Chrome 版本 61.0.3163.79(官方版本)(64 位)
<!-- saved from url=(0062)http://csf11.acs.uwosh.edu/371-17/demos/helloworld/square.html -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="line-gutter-backdrop"></div>
<table>
<tbody>
<tr>
<td class="line-number" value="1"></td>
<td class="line-content"><span class="html-comment"><!--square.html--></span></td>
</tr>
<tr>
<td class="line-number" value="2"></td>
<td class="line-content"><span class="html-doctype"><!DOCTYPE html></span></td>
</tr>
<tr>
<td class="line-number" value="3"></td>
<td class="line-content"><span class="html-tag"><html></span></td>
</tr>
<tr>
<td class="line-number" value="4"></td>
<td class="line-content"><br></td>
</tr>
<tr>
<td class="line-number" value="5"></td>
<td class="line-content"><br></td>
</tr>
<tr>
<td class="line-number" value="6"></td>
<td class="line-content"> <span class="html-tag"><script <span class="html-attribute-name">id</span>="<span class="html-attribute-value">vertex-shader</span>" <span class="html-attribute-name">type</span>="<span class="html-attribute-value">x-shader/x-vertex</span>"></span>
</td>
</tr> …Run Code Online (Sandbox Code Playgroud)我相信这是一个非常直截了当的问题.在Visual Studio 2015中,Ctr + M + O折叠了所有部分.我从这里学到了这个技巧:Visual Studio - 命令崩溃代码的所有部分?不幸的是,他在Visual Studio 2017中不起作用.