Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
i have textedit1.text it has a value 2 in my winform,..and then i have timedit called timePekerjaanStart value 04:00:00 . the case is i wanna addition between textedit1 and timePekerjaanStart ,i catch the result in timestamp called timePekerjaanEnd. so , i wanna get the result timePekerjaanEnd = textedit1 + timePekerjaanStart as like 2 + 04:00:00 = 06:00:00
You've not provided any attempts to solve it yourself but it's really quite straight forward:
var theHoursToAdd = int.Parse(textedit1.Text); // Error handling needs to be added
var startTime = timePekerjaanStart.Time;
timePekerjaanEnd.Time = startTime.AddHours(theHoursToAdd);
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 days ago.
Improve this question
Need to read all properties using contains. I want to return a new list where I enter contains with parameter string.
var newlist = list.Contains(text);
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I am trying to use the libphonenumber-csharp library and the FindNumbers feature. But I am unable to implement it properly. What am I doing wrong?
PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance();
var a = phoneUtil.findNumbers("this is my phone number: (805) 527-9975", null);
Console.WriteLine(a);
Console.Write(phoneUtil.findNumbers("8055279975", "US"));
public Iterable<PhoneNumberMatch> findNumbers(CharSequence text, String defaultRegion);
I tried the code and I am getting this as the output:
java.lang.Iterable1[com.google.i18n.phonenumbers.PhoneNumberMatch]
java.lang.Iterable1[com.google.i18n.phonenumbers.PhoneNumberMatch]
Are you getting the same result? looking into the issue now and I'll let you know if I figure it out.
EDIT
I was able to figure it out!
The correct way to do it is like this:
string testString = "testing the ability to grab here: 345-365-567";
{
PhoneNumberUtil phoneUtil = PhoneNumberUtil.GetInstance();
PhoneNumber phoneNumber = phoneUtil.Parse(testString, "US");
//now from here you can do ahead and retrieve the number by calling upon phoneNumber.
Console.WriteLine(phoneNumber.NationalNumber);
}
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
Convert a string into mac address as example 0000001 need to change as 00:00:01 In php i can get it by this $HexVal=rtrim(strtoupper(chunk_split($hexval, 2, ':')),':'); i need exactly same in C#.
I have the first 6 value as 00:01:AB and i got the last six value from a decimal number. If i input 1 then it needs to change as 00:00:01. so then i con-cat to get my full mac as 00:00:AB:00:00:01.
OK got it,,
var temp = Regex.Replace("000001", ".{2}", "$0:");
var tempo = temp.Remove(temp.Trim().Length - 1);//or
var tempo = temp.Trim(':');
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
Let's say we need to output 1000 # symbols in one line without loops or recursion. And surely without making a line of code with 1000 chars there.
The noob solution that comes to mind is...
string s = "#";
s = s+s+s+s+s+s+s+s+s+s;
s = s+s+s+s+s+s+s+s+s+s;
s = s+s+s+s+s+s+s+s+s+s;
Console.WriteLine(s);
Are there any others?
var repeatedString = new string('#', 1000);
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I want to replace the string Prab\A\kar to Prab\kar
I have tried like this
string temp = #"prab\A\kar";
temp = temp.Replace(#"\A\", #"\");
and i got as "prab\\kar". As i mentioned in the title I want it as "Prab\kar"
temp = temp.Replace(#"\A\", #"\");