character

sed delete remaining characters in line except first 5

☆樱花仙子☆ 提交于 2019-12-08 17:36:18
问题 what would be sed command to delete all characters in line except first 5 leading ones, using sed? I've tried going 'backwards' on this (reverted deleting) but it's not most elegant solution. 回答1: This might work for you (GNU sed): echo '1234567890' | sed 's/.//6g' 12345 Or: echo '1234567890' | cut -c-5 12345 回答2: Try this (takes 5 repetitions of 'any' character at the beginning of the line and save this in the first group, then take any number of repetition of any characters, and replace the

Is UTF-8 an encoding or a character set?

筅森魡賤 提交于 2019-12-08 16:08:44
问题 I thought that the name of the character set was "Unicode" and that "UTF-8" was the name of a particular encoding of the Unicode character set, but I often see the terms "encoding" and "charset" used interchangeably when referring to UTF-8. For example, <meta charset="UTF-8"> vs <?xml version="1.0" encoding="UTF-8" ?> 回答1: Is UTF-8 an encoding or a character set? UTF-8 is an encoding and that term is used in the RFC that defines it which is quoted below. I often see the terms "encoding" and

black left- / right-pointing triangles not the same size

你。 提交于 2019-12-08 15:31:51
问题 I'm using the black left pointing triangle / right left pointing triangle geometric shapes as links on a website, using their HTML codes ( ◀ and ▶): ◀ ▶ For some reason, the triangles are not displayed in the same size, even when I'm using them on a blank page with no other elements. On Chrome, the left pointing one is slightly larger than the right pointing one. On Firefox, the right pointing one is much larger then the left pointing one. I have the problem even when there's no CSS at all,

CSS Display One Character in 2 Colors [duplicate]

霸气de小男生 提交于 2019-12-08 14:56:32
问题 This question already has answers here : Is it possible to apply CSS to half of a character? (19 answers) Closed 5 years ago . Is it possible in css make a single character in 2 colors? I mean for example character "B" The first upper half in RED and the second half in BLUE 回答1: h1 { font-size: 72px; background: -webkit-linear-gradient(red 49%, blue 50%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; } Fill in your own vendor prefixes. 回答2: One solution would be: HTML:

Most basic way to insert a character into a string in Java?

戏子无情 提交于 2019-12-08 14:20:27
问题 Say I have a string x and I want to add some character x amount of times so that string x becomes of length y, how would I do this? String x = "this_is_a_line"; //x.length() = 14; length y = 20; //insert character into line so String x becomes balanced to: x = "this___is___a___line"; //x.length() = 20; Another example: String y = "in_it_yeah"; //y.length() = 10 length j = 15; //inserting characters so String y becomes balanced to: y = "in____it___yeah"; I want to avoid using StringBuilder to

Removing dots in a string in C

寵の児 提交于 2019-12-08 14:17:47
问题 I'm making a little program in C where I would put in a couple of numbers and dots and then delete all the dots (.). I was thinking about a whileloop but I cannot seem to quite understand what I should do next. So far I got this: #include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char *argv[]) { char s[30]; int k=0; printf("Enter your account number including dots. \n"); gets(s); printf("Account number without dots:"); while (s[k]!=0) { //????? } return 0; Am I on

Bash- loop through each character in a string to check for specific pattern

China☆狼群 提交于 2019-12-08 13:41:26
问题 So I need to check each character in a string- the input- to see if it matches/doesn't match a pattern. In Codelish: I'm guessing I'll have to use a for loop? inside for loop there would be- for each character in string do (the following) if it doesn't contain one/more number echo it doesn't contain contain one/more number fi [then other conditions] done. So what I'm trying to do is analyze each character in string and display error msg (for each condition) as output. Any help would be

How to convert from full-width to half-width Japanese characters in Java?

筅森魡賤 提交于 2019-12-08 09:12:23
问题 I'm using class Transliterator of the icu project to convert from half-width to full-width characters like this: Transliterator transliterator = Transliterator.getInstance("Hiragana-Katakana"); String converted = transliterator.transliterate("コンニチハ"); //half-width The result of converted is: コンニチハ (full-width) But: String converted = transliterator.transliterate("コンニチハ"); //full-width The result of converted is still: コンニチハ (full-width) My expectation is コンニチハ . Can anyone help me solve this?

using unicode characters with wxPython

吃可爱长大的小学妹 提交于 2019-12-08 08:52:15
问题 i have a problem with wxpython and his rich text control, when I try to insert unicode characters... \xb2 prints an apex '2', '\u2074' should print an apex '4'... edit: I use windows vista... and I tried 'coding cp1252 ' and 'utf-8' but with the same result... 2edit: on vista it crashs, on xp it shows a strange square (i guess it's when the pc doesn't recognize the character...) here is the source code: from __future__ import unicode_literals import wx import wx.richtext as rt class Trial(wx

separate 1 string into more

核能气质少年 提交于 2019-12-08 08:14:43
问题 Dear All, A have a string like this: a <- "Good,Good*********,Good***********,Perfect,Perfect**********,Perfect***********" now I want to separate this into this: a <- c("Good","Good*********","Good***********","Perfect","Perfect**********","Perfect***********") any suggestions are very welcome! Thanks you, Lisanne 回答1: strsplit does this: a<-"Good,Good***,Good****,Perfect,Perfect***,Perfect*****" a <- strsplit(a, ",")[[1]] 回答2: This type of problem is a perfect candidate for scan : scan(text