Actionscript:检查字符串是否包含域或子域(Actionscript: check if string contains domain or subdomain)

我需要知道字符串是否包含特定域

我有这样的数组

private var validDomain:Array  =  new Array(
  "http://*.site1.com",
  "http://*.site2.com",
  "http://*.site3.com",
  );

private var isValidDomain:Boolean =  false; 
private var URL:string =  "http://mysub.site2.com";  

现在我会检查我的字符串是否有效,所以我想是这样的:

for each (var domain_ in validDomain){
      if(SOMEREGEX){
      isValidDomain=true;
      }
  }

我把什么放在SOMEREGEX?!


I need to know if a string contains a specific domain

I have an array like this

private var validDomain:Array  =  new Array(
  "http://*.site1.com",
  "http://*.site2.com",
  "http://*.site3.com",
  );

private var isValidDomain:Boolean =  false; 
private var URL:string =  "http://mysub.site2.com";  

now i would check if my string is valid, so i think something like that:

for each (var domain_ in validDomain){
      if(SOMEREGEX){
      isValidDomain=true;
      }
  }

What i put in SOMEREGEX?!


原文:https://stackoverflow.com/questions/28029435
2024-05-06 09:05

满意答案

事实证明,我还必须将更新的主题作为道具传递给我的App组件(在层次结构中的Root下面)。 看起来它与主题通过上下文传递并且更改组件中的prop以配置主题的事实不足以触发所需的更新。


Turns out I had to also pass the updated theme as a prop to my App component (just below Root in the hierarchy). Seems like it's to do with the fact that the theme is passed via the context and changing a prop in the component that configures the theme wasn't enough to trigger the required updates.

相关问答

更多

redux商店应该只保留非UI状态吗?(Should the redux store keep only non-UI states?)

在Redux商店中保持“应用程序”状态和“UI”状态是完全合理的。 最终,取决于您在商店中放置的数据。 有关此主题的进一步讨论,请参见http://redux.js.org/docs/FAQ.html#organizing-state-only-redux-state 。 Keeping both "application" state and "UI" state in a Redux store is entirely reasonable. Ultimately, it's up to yo...

Material-ui TextField搞乱了react-redux(Material-ui TextField messing up with react-redux)

看起来您正在将合成事件传递给redux状态树。 您更有可能想要价值而不是事件本身。 例如: <TextField hintText="name" floatingLabelText="Your name:" onChange={(event) => handleChangeText(event)} /> 哪个叫: const handleChangeText = (event) => { console.log('the text is:', event.targ...

如何通过Redux商店动态更新Material UI主题?(How can I update Material UI theme dynamically via Redux store?)

事实证明,我还必须将更新的主题作为道具传递给我的App组件(在层次结构中的Root下面)。 看起来它与主题通过上下文传递并且更改组件中的prop以配置主题的事实不足以触发所需的更新。 Turns out I had to also pass the updated theme as a prop to my App component (just below Root in the hierarchy). Seems like it's to do with the fact that the t...

ReactJS + Redux:如何使用Material-UI的RaisedButton作为?(ReactJS + Redux: How to use Material-UI's RaisedButton as ?)

“containerElement”的值将是包含按钮的元素(换句话说,按钮的父级或包装器)。 不允许HTML输入包含任何其他元素,因此错误。 将您的输入作为按钮的子项: <RaisedButton label="Upload Image" labelColor='#88898C' labelStyle={{textTransform:'intial'}} backgroundColor='#1C1C1F'> <...

ReactJS + Redux - Material-UI:如何使浮动?(ReactJS + Redux - Material-UI: How to make floatable?)

您是否尝试将宽度设置为100%? 这对我有用: <Toolbar style={{ position: 'fixed', top: 0, width: '100%' }}> // Content </Toolbar> 要么: <Toolbar style={{ position: 'fixed', top: 0, left: 0, right: 0, }}> // Content </Toolbar> Have you t...

我如何将全局主题实现为React Material UI?(How do I implement global theme to React Material UI?)

正如这里的文档所述: 如果使用记录的主题overrides键,则需要使用以下样式表名称: MuiListItemText 所以你的代码应该是 const theme = createMuiTheme({ overrides: { MuiListItemText: { root: { color: 'red' } } } }); 源代码: https : //github...

如何在React Material-UI中应用字体主题?(How do I apply a Font Theme in React Material-UI?)

我明白了这一点。 我做了两件事,其中第一件我认为不重要: 我切换到使用完整的原始主题,然后实现像这样的组件: getChildContext: function() { return { muiTheme: ThemeManager.getMuiTheme(rawTheme) } }, 第二件事更可能是罪魁祸首,正在逃离'PT Sans'的空间,如下: //theme.js import Colors from 'material-...

Redux商店已更新,但UI未更新(Redux store is updated but UI is not)

这里的问题是它正在改变状态,而不是考虑我将我的评论存储为的事实 { [postId]: [array of comments] } 所以为了解决这个问题,我最终重写了我的减速器。 case COMMENTS_POST_VOTE: const { parentId } = action.payload // get commentId const commentList = [...state[parentId]] // get array of comments, but copy ...

由于重新渲染,在使用material-ui-redux-form时无法输入输入字段(can't type in input fields when using material-ui-redux-form due to re rendering)

尝试将减速器更改为 const rootReducer = combineReducers({ form: authReducer }) ReduxForm期望你的redux状态结构 { form: { formName: {} } } 如果需要使用除form之外的其他名称,则需要向reduxForm()装饰器提供getFormState(state) 。 Try changing your reducer to const rootReducer = combin...

带有Redux的Material UI v1 - 如何导出(Material UI v1 with Redux - How to export)

你需要安装npm install recompose或yarn add recompose 并在您的出口部分 export default compose( withStyles(styles, { name: 'App', }), connect(), )(AppFrame); 或者你可以这样做: export default withStyles(styles)(connect(select)(Cart)); you need to install n...

相关文章

更多

redis 字符串(String) SET 操作

命令格式: SET key value 把字符串值value存储到key中。如果存在此key,SE ...

Java String类

Java String类 字符串广泛应用在Java编程中,在Java中字符串属于对象,Java提 ...

遍历字符串每个字符,Stringreader是不是要比string.toCharArray来的快?

我想遍历一个字符串的每一个字符,以前是用string.toCharArray()来转换成一个char[ ...

Java 中String , StringBuffer 和StringBuilder

相信大家对 String 和 StringBuffer 的区别也已经很了解了,但是估计还是会有很多同志 ...

怎么得到String数组?

今天遇见一个问题.不知道怎么解决. 如: 自己建立了一个文件read.txt 里面存放这样的 键值 ...

mybatis There is no getter for property named 'xx' in 'class java.lang.String

用mybatis查询时,传入一个字符串传参数,且进行判断时,会报 There is no get ...

新手请教重写方法时,参数 Map<String, String> 提示 is not generic 错误

问题描述如下: 定义了一个抽象类,有一个run()方法实现,参数包含Map&lt;String,Str ...

字符串应用之字符串编码转换

无论是对程序的本地化还是国际化,都会涉及到字符编码的转换的问题。尤其在web应用中常常需要处理中文字符 ...

Python 字符串操作

Python 字符串操作,字符串序列用于表示和存储文本,python中字符串是不可变的,一旦声明,不能 ...

最新问答

更多

获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)

我用Google搜索了一个解决方案。 “EnumDisplayModeProvider”是我自己设置网站的各种模式的枚举。 public EnumDisplayModeProvider GetDisplayModeId() { foreach (var mode in DisplayModeProvider.Instance.Modes) if (mode.CanHandleContext(HttpContext)) {

如何通过引用返回对象?(How is returning an object by reference possible?)

这相对简单:在类的构造函数中,您可以分配内存,例如使用new 。 如果你制作一个对象的副本,你不是每次都分配新的内存,而是只复制指向原始内存块的指针,同时递增一个也存储在内存中的引用计数器,使得每个副本都是对象可以访问它。 如果引用计数降至零,则销毁对象将减少引用计数并仅释放分配的内存。 您只需要一个自定义复制构造函数和赋值运算符。 这基本上是共享指针的工作方式。 This is relatively easy: In the class' constructor, you allocate m

矩阵如何存储在内存中?(How are matrices stored in memory?)

正如它在“熵编码”中所说的那样,使用Z字形图案,与RLE一起使用,在许多情况下,RLE已经减小了尺寸。 但是,据我所知,DCT本身并没有给出稀疏矩阵。 但它通常会增强矩阵的熵。 这是compressen变得有损的点:输入矩阵用DCT传输,然后量化量化然后使用霍夫曼编码。 As it says in "Entropy coding" a zig-zag pattern is used, together with RLE which will already reduce size for man

每个请求的Java新会话?(Java New Session For Each Request?)

你是如何进行重定向的? 您是否事先调用了HttpServletResponse.encodeRedirectURL()? 在这里阅读javadoc 您可以使用它像response.sendRedirect(response.encodeRedirectURL(path)); The issue was with the path in the JSESSIONID cookie. I still can't figure out why it was being set to the tomca

css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)

我认为word-break ,如果你想在一个单词中打破行,你可以指定它,这样做可以解决问题: .column { word-break:break-all; } jsFiddle演示。 您可以在此处阅读有关word-break属性的更多信息。 I think word-break, with which you can specify if you want to break line within a word, will do the trick: .column { word-break

无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)

我认为您忘记在分类时间内缩放输入图像,如train_test.prototxt文件的第11行所示。 您可能应该在C ++代码中的某个位置乘以该因子,或者使用Caffe图层来缩放输入(请查看ELTWISE或POWER图层)。 编辑: 在评论中进行了一次对话之后,结果发现在classification.cpp文件中错误地删除了图像均值,而在原始训练/测试管道中没有减去图像均值。 I think you have forgotten to scale the input image during cl

xcode语法颜色编码解释?(xcode syntax color coding explained?)

转到: Xcode => Preferences => Fonts & Colors 您将看到每个语法高亮颜色旁边都有一个简短的解释。 Go to: Xcode => Preferences => Fonts & Colors You'll see that each syntax highlighting colour has a brief explanation next to it.

在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)

你考虑过第三方拼写检查吗? 您可以将在C#中开发的自定义WinForms控件插入访问数据库吗? VB6控件怎么样? 如果你能找到一个使用第三方库进行拼写检查的控件,那可能会有效。 Have you considered a third party spell checker? Can you insert a custom WinForms controls developed in C# into an access database? What about a VB6 control? If

从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)

我有同样的问题,因为我在远程服务器上有两个图像,我需要在每天的预定义时间复制到我的本地服务器,这是我能够提出的代码... try { if(@copy('url/to/source/image.ext', 'local/absolute/path/on/server/' . date("d-m-Y") . ".gif")) { } else { $errors = error_get_last(); throw new Exception($err

从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))

我不确定我完全明白你在说什么。 你能编辑你的帖子并包含你正在做的Subversion命令/操作的特定顺序吗? 最好使用命令行svn客户端,以便容易为其他人重现问题。 如果您只是想获取文件的旧副本(即使该文件不再存在),您可以使用如下命令: svn copy ${repo}/trunk/moduleA/file1@${rev} ${repo}/trunk/moduleB/file1 其中${repo}是您的存储库的URL, ${rev}是您想要的文件的版本。 这将恢复该文件的旧版本,包括最高版本