¡@

Home 

c# Programming Glossary: truncate

How to truncate milliseconds off of a .NET DateTime

http://stackoverflow.com/questions/1004698/how-to-truncate-milliseconds-off-of-a-net-datetime

to truncate milliseconds off of a .NET DateTime I'm trying to compare a..

Truncate string on whole words in .NET C#

http://stackoverflow.com/questions/1613896/truncate-string-on-whole-words-in-net-c-sharp

string on whole words in .NET C# I am trying to truncate some long text in C# but I don't want my string to be cut off.. a word. Does anyone have a function that I can use to truncate my string at the end of a word E.g This was a long string..... a long string... Not This was a long st... c# .net string truncate share improve this question Try the following. It is pretty..

How do I protect this function from SQL injection?

http://stackoverflow.com/questions/1862036/how-do-i-protect-this-function-from-sql-injection

list of specific tables you define as okay for your app to truncate as @John Buchanan suggests . Even after validating that tableName..

Truncate Two decimal places without rounding

http://stackoverflow.com/questions/3143657/truncate-two-decimal-places-without-rounding

Lets say I have a value of 3.4679 and want 3.46 how can I truncate to two decimal places that without rounding up I have tried..

Round a double to x significant figures

http://stackoverflow.com/questions/374316/round-a-double-to-x-significant-figures

The framework doesn't have a built in function to round or truncate as in your example to a number of significant digits. One way.. digit is right after the decimal point round or truncate then scale back. The following code should do the trick static.. d scale digits If as in your example you really want to truncate then you want static double TruncateToSignificantDigits this..

I got error “The DELETE statement conflicted with the REFERENCE constraint”

http://stackoverflow.com/questions/3776269/i-got-error-the-delete-statement-conflicted-with-the-reference-constraint

conflicted with the REFERENCE constraint&rdquo I tried to truncate a table with foreign keys and got the message Cannot truncate.. a table with foreign keys and got the message Cannot truncate table because it is being referenced by a FOREIGN KEY constraint.. don't want to drop and create foreign keys. c# sql delete truncate share improve this question The error means that you have..

Convert DateTime to Julian Date in C# (ToOADate Safe?)

http://stackoverflow.com/questions/5248827/convert-datetime-to-julian-date-in-c-sharp-tooadate-safe

days. If we multiply it by the number of months and then truncate to an integer we'll get a pattern of 0s and 1s. 0.6 0 0.0 0..

Are floating-point numbers consistent in C#? Can they be?

http://stackoverflow.com/questions/6683059/are-floating-point-numbers-consistent-in-c-can-they-be

they use 80 bit registers to do all the calculations then truncate to 64 or 32 bits leading to different rounding results than..

How to round a decimal for output?

http://stackoverflow.com/questions/697977/how-to-round-a-decimal-for-output

you can use Decimal.Truncate. Unfortunately it can only truncate ALL of the decimals. To solve this you could multiply by 100.. of the decimals. To solve this you could multiply by 100 truncate and divide by 100 like this decimal d ... d Decimal.Truncate..

Is there a better way in C# to round a DateTime to the nearest 5 seconds?

http://stackoverflow.com/questions/766626/is-there-a-better-way-in-c-sharp-to-round-a-datetime-to-the-nearest-5-seconds

that I've found these two previous questions however they truncate rather than round the time. c# algorithm datetime performance..

Strange behavior when casting a float to int in C#

http://stackoverflow.com/questions/8911440/strange-behavior-when-casting-a-float-to-int-in-c-sharp

and rounding to the nearest float which is 62. You then truncate that float to an integer and the result is 62. Exercise Explain..

How to truncate milliseconds off of a .NET DateTime

http://stackoverflow.com/questions/1004698/how-to-truncate-milliseconds-off-of-a-net-datetime

into an extension method public static DateTime Truncate this DateTime dateTime TimeSpan timeSpan return dateTime.AddTicks.. timeSpan.Ticks which is used as follows dateTime dateTime.Truncate TimeSpan.FromMilliseconds 1 Truncate to whole ms dateTime dateTime.Truncate.. dateTime dateTime.Truncate TimeSpan.FromMilliseconds 1 Truncate to whole ms dateTime dateTime.Truncate TimeSpan.FromSeconds..

Truncate string on whole words in .NET C#

http://stackoverflow.com/questions/1613896/truncate-string-on-whole-words-in-net-c-sharp

string on whole words in .NET C# I am trying to truncate some.. space starting at the desired length. public static string TruncateAtWord this string value int length if value null value.Length..

Truncate Two decimal places without rounding

http://stackoverflow.com/questions/3143657/truncate-two-decimal-places-without-rounding

Two decimal places without rounding Lets say I have a value.. math rounding share improve this question value Math.Truncate 100 value 100 Beware that fractions like these cannot be accurately..