Commits

M6 KVM committed 7c2e9ac

Avoid extra space at the end of the hex string

Comments (0)

Files changed (1)

 sub SplitPara($) {
 	my $Str = shift;
 	my $l = length($Str);
-	return substr($Str, 0, $l/2) . substr($Str, ($l/2)-1);
+	return substr($Str, 0, ($l/2)+1) . substr($Str, ($l/2));
 }
 
 sub PrintRow($$) {
 	my ( $hex, $printable ) = ( '', '' );
 	my $printed_count = 0;
 	my $hexPadding;
+	my $elems = scalar(@$Line);
 
-	foreach my $char ( @$Line ) {
-		$hex .= sprintf('%02x ', ord($char));
+	for ( my $i = 0; $i < $elems; $i++ ) {
+		my $char = $Line->[$i];
+		$hex .= sprintf('%02x', ord($char));
+		$hex .= ' ' if ( $i+1 < $elems );
 		$char = '.' if ( $char !~ m/\p{PosixPrint}/ );
 		$printable .= $char;
 		$printed_count++;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.