【转】Maya Mel – Search String in String
转自:http://schiho.com/?p=179
Hi,
this is a little script which returns a 0 or 1 if the searched text is in a string. Compared with the match function in mel, this one returns 1 or 0, which is more convenient for my opinion. Furthermore somtimes i get really weired results with the match func().
global proc int ySearch(string $searchWord, string $searchInText){
string $longText = $searchInText;
string $shortText = $searchWord;
int $i = 0;
int $j = 0;
string $searchText = “”;
for($i = 1; $i <= (size($longText)-1); $i++){
for($j = $i; $j <= size($longText); $j++){
$searchText = substring($longText, $i, $j);
//print(” i ” + $i + ” ” + $j + ” j \n”);
if ($searchText == $shortText){
return 1;
//print(“drinnen”);
}
}
}
return 0;
}
//Usage:
ySearch(“where is schiho today?”, “schiho”);
//Result: 1
转载于:https://www.cnblogs.com/fzzl/p/3142410.html
【转】Maya Mel – Search String in String相关推荐
- maya mel uf8_MAYA MEL问题
展开全部 choice 就是一个 Mel 命令,具体用法看32313133353236313431303231363533e58685e5aeb931333238653861Help去,以下是Help ...
- static string java_java:String类、static关键字、Arrays类、 Math类
public voidStrMethodTest(){/** public int length () :返回此字符串的长度. * public String concat (String str) ...
- 转换ArrayList String 到String []数组[重复]
本文翻译自:Convert ArrayList to String[] array [duplicate] This question already has an answer here: 这个问题 ...
- C#中的String和string有什么区别?还有ref关键字怎么用?
String 和 string 没有区别 string 是 String 的别名 ref 关键字一般只用于函数参数中,这个参数是 struct 类型,而不是 class 类型 因为 class 类型在 ...
- shell中$后加引号有什么用($string和$'string')
bash&shell系列文章:http://www.cnblogs.com/f-ck-need-u/p/7048359.html 有些时候在某些服务管理脚本中看到$"$string& ...
- 【错误记录】Kotlin 编译报错 ( Type mismatch: inferred type is String? but String was expected )
文章目录 一.报错信息 二.解决方案 一.报错信息 Google Play 上架要求 Android 的编译版本 和 目标版本都要高于 30 才可以上传 ; 将 Android 的编译版本 和 目标版 ...
- C#String与string大小写的区别
1.string是c#中的类,String是.net Framework的类(在c# IDE中不会显示蓝色) 2.C# string映射为.net Framework的String 3.如果用 ...
- Java提升篇:理解String 及 String.intern() 在实际中的应用
String的深入解析 首先String不属于8种基本数据类型,String是一个对象. 因为对象的默认值是null,所以String的默认值也是null:但它又是一种特殊的对象,有其它对象没有的一些 ...
- python timeit class Timer()类 timeit(string, string) repeat(string, string) default_timer() 耗时检测 执行速度
#! /usr/bin/env python3"""Tool for measuring execution time of small code snippets. 用 ...
最新文章
- mysql数据库优化命令_MySQL数据库优化总结
- 人工智能:AI 芯片快速起航
- 统一沟通-技巧-11-Lync-联盟-1-MSN
- [Node.js]常用工具
- 步步为营(十六)搜索(二)BFS 广度优先搜索
- Android中添加背景音乐的两种方法
- ORACLE的分布式管理
- VS2010 工具箱组件添加重复
- ES6新特性_ES6语法糖_ES5中构造函数的继承---JavaScript_ECMAScript_ES6-ES11新特性工作笔记035
- 简单实现下载功能--jsp,servlet
- 兜兜转转~~,忘不了的break!! 忘不了的continue!!!!
- 中日海军实力分类比较
- 如何在Android上关闭YouTube烦人的自动播放缩略图
- fio_generate_plots
- 亚马逊服务器一键重装系统,如何使用Amazon Alexa轻松设置智能家居设备
- 财管U08 公司估值 教材笔记
- 【mcuclub】四相五线步进电机
- python里randint是什么意思_Python中random.randint方法(精选)
- SQL Server数据库入门学习
- SQL优化不会?推荐4 款工具