substring

Replacing Email Domains

▼魔方 西西 提交于 2020-01-22 02:07:27
问题 I'm trying to change the inputted domain name to a new domain name, for example, "hotmail.com" becomes "outlook.com". I believe I'm on the right track, just my substring is off. CREATE OR REPLACE PROCEDURE PR_ChangeDomain (P_Email_Address varchar2) IS Cursor C_Email IS Select Email_Address, Broker_Number From Customer Where Email_Address = P_Email_Address; V_Email varchar2(50); BEGIN Open C_Email; Fetch C_Email into V_Email; While C_Email%FOUND LOOP Update Customer Set Email_Address = SUBSTR(

LeetCode-3 Longest Substring Without Repeating Characters

五迷三道 提交于 2020-01-21 22:57:52
Description Given a string, find the length of the longest substring without repeating characters. Example Example 1: Input: “abcabcbb” Output: 3 Explanation: The answer is “abc”, with the length of 3. Example 2: Input: “bbbbb” Output: 1 Explanation: The answer is “b”, with the length of 1. Example 3: Input: “pwwkew” Output: 3 Explanation: The answer is “wke”, with the length of 3. Note that the answer must be a substring, “pwke” is a subsequence and not a substring. Submissions 首先由Example 3知题目要求必须是substring,即原字符串中连续的字符串,而subsequence可以不是。 下面是我的解题思路: 采用滑动窗口的形式,从左往右依次遍历字符串s,如果不在temp中,则加入,扩大右边界

Can a hash key have multiple 'subvalues' in perl?

▼魔方 西西 提交于 2020-01-21 13:57:12
问题 I have a list of genes and the following information: Their name 'XLOC_0000...' The genomic scaffold on which they're located 'Scaffold...' The location of each feature on its Scaffold ('start', 'stop') I've written a piece of Perl code that finds each gene in the genomic scaffolds and saves it to a file. Briefly, first I put each gene in a hash of arrays, e.g. my %geneID = map { $xloc[$_] => [ $scaffold[$_], $start[$_], $stop[$_] ] } (0 .. $#xloc); I then make a hash of the fasta file

Can a hash key have multiple 'subvalues' in perl?

本小妞迷上赌 提交于 2020-01-21 13:55:07
问题 I have a list of genes and the following information: Their name 'XLOC_0000...' The genomic scaffold on which they're located 'Scaffold...' The location of each feature on its Scaffold ('start', 'stop') I've written a piece of Perl code that finds each gene in the genomic scaffolds and saves it to a file. Briefly, first I put each gene in a hash of arrays, e.g. my %geneID = map { $xloc[$_] => [ $scaffold[$_], $start[$_], $stop[$_] ] } (0 .. $#xloc); I then make a hash of the fasta file

Ellipsis with C# (ending on a full word)

一个人想着一个人 提交于 2020-01-21 06:50:47
问题 I'm trying to implement ellipsis in Umbraco, the requirement being 15 characters of intro text but always ending on a full word. I thought of using XSLT, but then realised that I can use a simple extension method written in C# instead. I can easily substring the text and append "..." but am stuck with the issue of having to end it with a full word.. Here's my code so far (very complicated :p) public string Ellipsis(string text, int length) { return text.Substring(0, length) + "..."; } Example

Ellipsis with C# (ending on a full word)

南楼画角 提交于 2020-01-21 06:50:43
问题 I'm trying to implement ellipsis in Umbraco, the requirement being 15 characters of intro text but always ending on a full word. I thought of using XSLT, but then realised that I can use a simple extension method written in C# instead. I can easily substring the text and append "..." but am stuck with the issue of having to end it with a full word.. Here's my code so far (very complicated :p) public string Ellipsis(string text, int length) { return text.Substring(0, length) + "..."; } Example

开始写博客吧,记录每一次的学习新的

放肆的年华 提交于 2020-01-20 18:08:52
SELECT a.AuxiliaryName, a.AuxiliaryDetailId, b.AuxiliaryName FROM `Finance_VoucherBillDetail` a INNER JOIN Finance_VoucherAuxiliary b ON a.AuxiliaryDetailId = b.AuxiliaryDetailId WHERE a.AuxiliaryDetailId <> '0' AND b.AuxiliaryName <> (SELECT SUBSTRING_INDEX( a.AuxiliaryName, '&', -1))   可以用在sql中进行字段内容的截取,我是用来做比较的判断。 SELECT SUBSTRING_INDEX的用法:   substring_index(被截取字段,关键字,关键字出现的次数)   例:select substring_index(a.AuxiliaryName,"&",-1)   结果:a.AuxiliaryName中‘&’后面的部分。   (注:如果关键字出现的次数是负数 如-2 则是从后倒数,到字符串结束) 来源: https://www.cnblogs.com/yuanbuyuan/p/12218851.html

如何分割字符串以便可以访问项目x?

ぐ巨炮叔叔 提交于 2020-01-20 12:39:39
使用SQL Server,如何分割字符串以便可以访问项x? 取一个字符串“ Hello John Smith”。 我如何按空格分割字符串并访问索引1的项目,该项目应返回“ John”? #1楼 我认为你们正在使它变得过于复杂。 只需创建CLR UDF并完成它即可。 using System; using System.Data; using System.Data.SqlClient; using System.Data.SqlTypes; using Microsoft.SqlServer.Server; using System.Collections.Generic; public partial class UserDefinedFunctions { [SqlFunction] public static SqlString SearchString(string Search) { List<string> SearchWords = new List<string>(); foreach (string s in Search. Split (new char[] { ' ' })) { if (!s.ToLower().Equals("or") && !s.ToLower().Equals("and")) { SearchWords.Add(s); } }

459-重复的子字符串

你说的曾经没有我的故事 提交于 2020-01-18 20:44:53
459-重复的子字符串 给定一个非空的字符串,判断它是否可以由它的一个子串重复多次构成。给定的字符串只含有小写英文字母,并且长度不超过10000。 示例 1: 输入: "abab" 输出: True 解释: 可由子字符串 "ab" 重复两次构成。 示例 2: 输入: "aba" 输出: False 示例 3: 输入: "abcabcabcabc" 输出: True 解释: 可由子字符串 "abc" 重复四次构成。 (或者子字符串 "abcabc" 重复两次构成。) 来源:力扣(LeetCode) 链接: https://leetcode-cn.com/problems/repeated-substring-pattern 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 public boolean repeatedSubstringPattern_1(String s) { for(int len = s.length() / 2; len >= 1; len--) { if(s.length() % len == 0) { String repeat = s.substring(0, len); int index = 0; String tmp = s; while (index == 0 && len < tmp.length()) { tmp =

关于String的截取输出的一个使用。

冷暖自知 提交于 2020-01-18 17:17:19
这个呢,是我在写一个爬虫时遇到的问题,关于问题的描述是这样的,我有一个字符串,想得到其中的一段,即截取其中的一部分所用,方法如下: 使用substring( start , stop )方法,在W3中对于这个函数的解释链接:https://www.w3school.com.cn/js/jsref_substring.asp 要注意: substring() 方法返回的子串包括 start 处的字符,但不包括 stop 处的字符。 怎们说呢,用代码解释比较简单: String str = "123456";//声明一个字符串备用 String jiequ1,jiequ2;//声明一个截取字符串 jiequ1 = str.substring(1, 2);//包括头,不包括尾,即应输出2 jiequ2 = str.substring(2, 5);//应输出345 System.out.println("原字符串:"+str); System.out.println("截取到的字符串1:"+jiequ1); System.out.println("截取到的字符串2:"+jiequ2);   输出如图示: 大概使用方法就是这样了。 来源: https://www.cnblogs.com/msdog/p/12209254.html