This method returns a Rectangle based on a String.
Possible values are the the names of a constant in this class
(for instance "A4", "LETTER",...) or a value like "595 842"
19490
public static Rectangle getRectangle(String name)  {
    	name = name.trim().toUpperCase();
    	int pos = name.indexOf(' ');
        if (pos == -1) {
            try {            
                Field field = PageSize.class.getDeclaredField(name.toUpperCase());
                return (Rectangle) field.get(null);
            } catch (Exception e) {
                throw new RuntimeException("Can't find page size " + name);          
            }
        }
        else {
        	try {
        		String width = name.substring(0, pos);
        		String height = name.substring(pos + 1);
        		return new Rectangle(Float.parseFloat(width), Float.parseFloat(height));
        	} catch(Exception e) {
        		throw new RuntimeException(name + " is not a valid page size format; " + e.getMessage());
        	}
        }
    }
533245
public Rectangle getBoundingClientRect(final By by) {
		WebElement el = findElement(by);

		@SuppressWarnings("unchecked")
		Map<String, Number> result = (Map<String, Number>) executeScript(JS_GET_BOUNDING_CLIENT_RECT, el);
		Rectangle rectangle = new Rectangle(result.get("top").intValue(), result.get("left").intValue(),
			result.get("bottom").intValue(), result.get("right").intValue(), result.get("width").intValue(),
			result.get("height").intValue());

		LOGGER.info("Bounding client rect for {}: {}", by, rectangle);
		return rectangle;
	}
771407
def str(self, space=False):
    """"""
    return "%s/%s (%s)" % (str(int(self.id)).rjust(space and 4),
                           self.name.ljust(space and 50),
                           "; ".join(str(a) for a in self.args))
801143
function(str) {
      if (v.isNumber(str)) {
        // If there are more than 2 decimals round it to two
        if ((str * 100) % 1 === 0) {
          return "" + str;
        } else {
          return parseFloat(Math.round(str * 100) / 100).toFixed(2);
        }
      }

      if (v.isArray(str)) {
        return str.map(function(s) { return v.prettify(s); }).join(", ");
      }

      if (v.isObject(str)) {
        return str.toString();
      }

      // Ensure the string is actually a string
      str = "" + str;

      return str
        // Splits keys separated by periods
        .replace(/([^\s])\.([^\s])/g, '$1 $2')
        // Removes backslashes
        .replace(/\\+/g, '')
        // Replaces - and - with space
        .replace(/[_-]/g, ' ')
        // Splits camel cased words
        .replace(/([a-z])([A-Z])/g, function(m0, m1, m2) {
          return "" + m1 + " " + m2.toLowerCase();
        })
        .toLowerCase();
    }
163518
String getPattern() {
        final StringBuilder result = new StringBuilder();

        if (myPrefix != null) {
            result.append(myPrefix);
        }
        if (mySuffixes != null) {
            result.append("*");
            for (final Literal sub : mySuffixes) {
                result.append(sub);
                result.append("*");
            }
        }
        if (myPostfix != null) {
            result.append(myPostfix);
        }
        return result.toString();
    }
1221504
static public String intToHexString(int n, int width) {
        StringBuilder  dest = new StringBuilder(width);
        dest.append(Integer.toHexString(n));
        while (dest.length() < width) {
           dest.insert(0, ' ');
        }
        return dest.toString();
    }
842064
def _n(name):
    """"""
    n = name.encode('ascii', errors='ignore').decode('ascii')
    n = re.sub('[^A-Za-z0-9_]', '_', n)
    n = re.sub(r'(^[0-9].*)', r'p\1', n)
    return n
361265
def rectangle(self):
        
        if self.start_point is None or self.end_point is None:
            return QgsRectangle()
        elif self.start_point.x() == self.end_point.x() or \
                self.start_point.y() == self.end_point.y():
            return QgsRectangle()

        return QgsRectangle(self.start_point, self.end_point)
548404
def toStringArray(name, a, width = 0):
    
    string = name + ": "
    cnt = 0
    for i in a:
        string += "%4.2f  " % i 
        if width > 0 and (cnt + 1) % width == 0:
            string += '\n'
        cnt += 1
    return string
228399
def from_string(value):
        
        if value == None or len(value) == 0:
            return None
                
        tokens = value.split(":")
        if len(tokens) != 5:
            raise ConfigException(
                None, "BAD_DESCRIPTOR", "Descriptor " + str(value) + " is in wrong format"
            ).with_details("descriptor", value)
            
        return Descriptor(tokens[0].strip(), tokens[1].strip(), tokens[2].strip(), tokens[3].strip(), tokens[4].strip())
717124
public Rectangle getBarcodeSize() {
        float fontX = 0;
        float fontY = 0;
        String text = code;
        if (generateChecksum && checksumText)
            text = calculateChecksum(code);
        if (!startStopText)
            text = text.substring(1, text.length() - 1);
        if (font != null) {
            if (baseline > 0)
                fontY = baseline - font.getFontDescriptor(BaseFont.DESCENT, size);
            else
                fontY = -baseline + size;
            fontX = font.getWidthPoint(altText != null ? altText : text, size);
        }
        text = code;
        if (generateChecksum)
            text = calculateChecksum(code);
        byte bars[] = getBarsCodabar(text);
        int wide = 0;
        for (int k = 0; k < bars.length; ++k) {
            wide += bars[k];
        }
        int narrow = bars.length - wide;
        float fullWidth = x * (narrow + wide * n);
        fullWidth = Math.max(fullWidth, fontX);
        float fullHeight = barHeight + fontY;
        return new Rectangle(fullWidth, fullHeight);
    }
509409
public Rectangle getBarcodeSize() {
        float width = ((code.length() + 1) * 5 + 1) * n + x;
        return new Rectangle(width, barHeight);
    }
23065
protected Rectangle getFindButtonBounds() {
        JTextComponent c = getComponent();
        final int      x = c.getHeight() / 2 - 6;
        final int      y = c.getHeight() / 2 - 6;

        return new Rectangle(x, y, 22, 17);
    }
192719
def get_size(self):
        
        rec = self.get_rectangle()
        return (int(rec[2]-rec[0]), int(rec[3]-rec[1]))
184869
private static int getXIndex(PatternFinderUser def, int x,
            Segment<PrimitiveParameter> lastMatch) {
        int skipStart = def.getSkipStart();
        if (lastMatch != null && skipStart > 0) {
            return Math.max(x, lastMatch.getFirstIndex() + skipStart);
        } else if (lastMatch != null && def.getSkip() > 0) {
            return Math.max(x, lastMatch.getLastIndex() + def.getSkip());
        } else {
            return x;
        }
    }
1083316
public static long atol( String s ) {
        int i = 0;

        while( i < s.length() && Character.isWhitespace(s.charAt(i)) ) {
            i++;
        }
        if (i < s.length() && s.charAt(i) == '0') {
            if (i + 1 < s.length() && (s.charAt(i + 1) == 'x' || s.charAt(i + 1) == 'X')) {
                return parseLong(s.substring(i + 2), 16);
            } else {
                return parseLong(s, 8);
            }
        } else {
            return parseLong(s, 10);
        }
    }
816690
public Rectangle2D getBoundingBox() {
		Dimension glyphDimension = getMetrics().getGlyphDimension(getNotationContext());
		if (isStemUp()) {
			return new Rectangle2D.Double(
				(int)(getBase().getX()),
                stemYEnd,
				getWidth(),
				getStemBeginPosition().getY()-stemYEnd+glyphDimension.getHeight()/2);
		}
		else {
			return new Rectangle2D.Double(
				(int)(getBase().getX()),
				getStemBeginPosition().getY()-glyphDimension.getHeight()/2,
				getWidth(),
				stemYEnd-getStemBeginPosition().getY()+1+glyphDimension.getHeight()/2);
		}
	}