10 More Discussions You Might Find Interesting
1. Programming
I have a string s
Are the following equivalent?
if ( ! s.empty() ) {
}
if ( s ) {
} (1 Reply)
Discussion started by: kristinu
1 Replies
2. Shell Programming and Scripting
Hi ,
I have a file likeA-0044150|ABC/Frito/
A-0044150|GFHU
A-0150075|Bud Racing
A-0187811|Bud Light
A-0187811|RW&B signmaking
I Want the o/p likeA-0044150|ABC/Frito/,GFHU
A-0150075|Bud Racing
A-0187811|Bud Light,RW&B signmaking (2 Replies)
Discussion started by: jagdishrout
2 Replies
3. Shell Programming and Scripting
Hey fellas,
I've posted this problem a few days back and I received just one post which was in PHP that I have no idea about! (Thanks to DGPickett) It would be so nice if you can help me with this in Shell or Perl. Here is the story:
I have a big table with variables and observations. I... (9 Replies)
Discussion started by: @man
9 Replies
4. Shell Programming and Scripting
here is what i want to achieve... consider a file contains below contents. the file size is large about 60mb
cat dump.sql
INSERT INTO `table1` (`id`, `action`, `date`, `descrip`, `lastModified`) VALUES (1,'Change','2011-05-05 00:00:00','Account Updated','2012-02-10... (10 Replies)
Discussion started by: vivek d r
10 Replies
5. Shell Programming and Scripting
Is there code in Cshell scripting to check for the presence of any files in the current directory (and only the current directory)? I tried:
if (-r *) then ...
but Cshell doesn't like that.
Thanks,
Paul Hudgens (0 Replies)
Discussion started by: phudgens
0 Replies
6. Shell Programming and Scripting
I have tried the following script to check for the presence of any files in a folder:
if (-r *) then
goto ZipMiscFiles
else
echo ""
echo " No Miscellaneous files found. Exiting program."
echo ""
exit
endif
The -r works fine with the wildcard in combo with other... (4 Replies)
Discussion started by: phudgens
4 Replies
7. Shell Programming and Scripting
lets think str is a variable...how can i check it is pure alphabetic or not
for numeric checking i have used echo $str|grep -v ]
but the command echo $str|grep -v ] is not working (1 Reply)
Discussion started by: arghya_owen
1 Replies
8. Shell Programming and Scripting
please help me providing the code of checking a string pure numeric or not and pure alphanumeric or not (6 Replies)
Discussion started by: arghya_owen
6 Replies
9. UNIX for Dummies Questions & Answers
How could I check if a string variable contains at least (or only) 2 characters, and check and make sure that the string does not contain any numeric digits?...I need to know how to do this as simple as possible. and I am using the Ksh shell. Thanks. (1 Reply)
Discussion started by: developncode
1 Replies
10. Shell Programming and Scripting
G'day guys, first post so be gentle.
I need help with some code to work out if a variable (string) contains any integers. The valid variable (string) must contain only letters.
Also need to be able to work out if a variable contains only integers.
Any help greatly appreciated. (7 Replies)
Discussion started by: haz
7 Replies
CRC32(3) 1 CRC32(3)
crc32 - Calculates the crc32 polynomial of a string
SYNOPSIS
int crc32 (string $str)
DESCRIPTION
Generates the cyclic redundancy checksum polynomial of 32-bit lengths of the $str. This is usually used to validate the integrity of data
being transmitted.
Warning
Because PHP's integer type is signed many crc32 checksums will result in negative integers on 32bit platforms. On 64bit installa-
tions all crc32(3) results will be positive integers though.
So you need to use the "%u" formatter of sprintf(3) or printf(3) to get the string representation of the unsigned crc32(3) checksum
in decimal format.
For a hexadecimal representation of the checksum you can either use the "%x" formatter of sprintf(3) or printf(3) or the dechex(3)
conversion functions, both of these also take care of converting the crc32(3) result to an unsigned integer.
Having 64bit installations also return negative integers for higher result values was considered but would break the hexadecimal
conversion as negatives would get an extra 0xFFFFFFFF######## offset then. As hexadecimal representation seems to be the most common
use case we decided to not break this even if it breaks direct decimal comparisons in about 50% of the cases when moving from 32 to
64bits.
In retrospect having the function return an integer maybe wasn't the best idea and returning a hex string representation right away
(as e.g. md5(3) does) might have been a better plan to begin with.
For a more portable solution you may also consider the generic hash(3). hash("crc32b", $str) will return the same string as
dechex(crc32($str)).
PARAMETERS
o $str
- The data.
RETURN VALUES
Returns the crc32 checksum of $str as an integer.
EXAMPLES
Example #1
Displaying a crc32 checksum
This example shows how to print a converted checksum with the printf(3) function:
<?php
$checksum = crc32("The quick brown fox jumped over the lazy dog.");
printf("%u
", $checksum);
?>
SEE ALSO
hash(3), md5(3), sha1(3).
PHP Documentation Group CRC32(3)