100+ results for 'php trim'

Not the results you expected?

phony-test.js (https://github.com/neocotic/phony.js.git) JavaScript · 467 lines

26 return q.nfcall(fs.readFile, filePath, {encoding: 'utf8'})

27 .then(function(fixture) {

28 return fixture.trim();

29 });

30 }

ezisbn10to13converter.php (https://bitbucket.org/ericsagnes/ezpublish-multisite.git) PHP · 355 lines

1 <?php

2 /**

3 * File containing the eZISBN10To13Converter class.

270 {

271 $isbnNumber = $contentObjectAttribute->attribute( 'data_text' );

272 $isbnValue = trim( $isbnNumber );

273 $error = false;

274

283 $digits = preg_replace( "/\-/", "", $isbnValue );

284

285 if ( trim( $digits ) != "" )

286 {

287 // If the length of the number is 10, it is an ISBN-10 number and need

Int32Rect.cs (https://github.com/dotnet/wpf.git) C# · 438 lines

181 String firstToken = th.NextTokenRequired();

182

183 // The token will already have had whitespace trimmed so we can do a

184 // simple string compare.

185 if (firstToken == "Empty")

ListenerOptions.php (https://gitlab.com/yousafsyed/easternglamor) PHP · 396 lines

1 <?php

2 /**

3 * Zend Framework (http://framework.zend.com/)

268 {

269 if ($this->getConfigCacheKey()) {

270 return $this->getCacheDir() . '/module-config-cache.' . $this->getConfigCacheKey().'.php';

271 }

272

273 return $this->getCacheDir() . '/module-config-cache.php';

274 }

275

352 {

353 if ($this->getModuleMapCacheKey()) {

354 return $this->getCacheDir() . '/module-classmap-cache.' . $this->getModuleMapCacheKey() . '.php';

355 }

356

Clients.php (https://gitlab.com/my-application.bjoernbartels.earth/module-admin) PHP · 322 lines

1 <?php

2 /**

3 * BB's Zend Framework 2 Components

85 'filters' => array(

86 array('name' => 'StripTags'),

87 array('name' => 'StringTrim'),

88 ),

89 'validators' => array(

108 'filters' => array(

109 array('name' => 'StripTags'),

110 array('name' => 'StringTrim'),

111 ),

112 'validators' => array(

131 'filters' => array(

132 array('name' => 'StripTags'),

133 array('name' => 'StringTrim'),

134 ),

135 'validators' => array(

sfValidatorBaseTest.php (https://github.com/malacon/pprl.git) PHP · 246 lines

1 <?php

2

3 /*

9 */

10

11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php');

12

13 $t = new lime_test(47);

111 $t->is($e->getCode(), 'required', '->clean() throws a sfValidatorError');

112 }

113 $t->is($v->clean(' foo '), ' foo ', '->clean() does not trim whitespaces by default');

114

115 // ->isEmpty()

131 $v->setOption('required', false);

132 $t->is($v->clean(''), null, '->setOption() changes options (required for example)');

133 $v->setOption('trim', true);

134 $t->is($v->clean(' foo '), 'foo', '->setOption() can turn on whitespace trimming');

WufooApiWrapper.php (https://github.com/Fourshift/Wufoo-API-Wrappers.git) PHP · 270 lines

1 <?php

2

3 require_once('WufooApiWrapperBase.php');

4 require_once('WufooValueObjects.php');

5

6 /**

95 public function getEntries($identifier, $from = 'forms', $getArgs = '', $index = 'EntryId') {

96 $url = $this->getFullUrl($from.'/'.$identifier.'/entries');

97 $url.= ($getArgs) ? '?'. ltrim($getArgs, '?') : '';

98 return $this->getHelper($url, 'Entry', 'Entries', $index);

99 }

110 public function getEntryCount($identifier, $from = 'forms', $getArgs = '') {

111 $url = $this->getFullUrl($from.'/'.$identifier.'/entries/count');

112 $url.= ($getArgs) ? '?'. ltrim($getArgs, '?') : '';

113 $this->curl = new WufooCurl();

114 $countObject = json_decode($this->curl->getAuthenticated($url, $this->apiKey));

stylies.php (https://gitlab.com/phamngsinh/baitaplon_sinhvien) PHP · 347 lines

1 <?php

2 defined('JPATH_BASE') or die();

3

34 $aryParams = explode("\n",$paramsConfigObj[0]->params);

35 foreach($aryParams as $item){

36 $posStyle = strpos(trim($item),'layout_style=');

37 if($posStyle === false){

38 } else {

39 $layoutStyle = substr(trim($item),$posStyle+(int)strlen('layout_style='));

40 }

41 }

124 var jvMaju = $$('.jv_slide_stylemaju');

125 var jvStyle7 = $$('.jv_slide_style7');

126 var layout = "<?php echo $layoutStyle; ?>";

127 var selectStyle = function(style){

128 switch(style){

Dao.php (https://github.com/pimcore/pimcore.git) PHP · 315 lines

1 <?php

2

3 /**

107 if ($countValues) {

108 if ($this->model->getVariantMode() == ProductListInterface::VARIANT_MODE_INCLUDE_PARENT_OBJECT) {

109 $query = "SELECT TRIM(`$fieldname`) as `value`, count(DISTINCT o_virtualProductId) as `count` FROM "

110 . $this->model->getCurrentTenantConfig()->getTablename() . ' a '

111 . $this->model->getCurrentTenantConfig()->getJoins()

112 . $condition . ' GROUP BY TRIM(`' . $fieldname . '`)';

113 } else {

114 $query = "SELECT TRIM(`$fieldname`) as `value`, count(*) as `count` FROM "

115 . $this->model->getCurrentTenantConfig()->getTablename() . ' a '

116 . $this->model->getCurrentTenantConfig()->getJoins()

117 . $condition . ' GROUP BY TRIM(`' . $fieldname . '`)';

118 }

119

psb.input.js (https://github.com/wildanm/Jibas.git) JavaScript · 292 lines

4 var dept = $("#psb_departemen").val();

5 $.ajax({

6 url : 'psb/psb.input.ajax.php?op=getTambahanData&dept='+dept,

7 type: 'get',

8 success : function(html) {

12

13 $.ajax({

14 url : 'psb/psb.input.ajax.php?op=setProsesPsb&dept='+dept,

15 type: 'get',

16 success : function(html) {

20 //alert('Get Kelompok with Proses ' + proses);

21 $.ajax({

22 url : 'psb/psb.input.ajax.php?op=setKelompokPsb&proses='+proses,

23 type: 'get',

24 success : function(html) {

User_agent.php (https://github.com/usagi-project/mynets1.git) PHP · 500 lines

1 <?php if (!defined('BASEPATH')) exit('No direct script access allowed');

2 /**

3 * CodeIgniter

4 *

5 * An open source application development framework for PHP 4.3.2 or newer

6 *

7 * @package CodeIgniter

61 if (isset($_SERVER['HTTP_USER_AGENT']))

62 {

63 $this->agent = trim($_SERVER['HTTP_USER_AGENT']);

64 }

65

257 if ((count($this->languages) == 0) AND isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) AND $_SERVER['HTTP_ACCEPT_LANGUAGE'] != '')

258 {

259 $languages = preg_replace('/(;q=[0-9\.]+)/i', '', strtolower(trim($_SERVER['HTTP_ACCEPT_LANGUAGE'])));

260

261 $this->languages = explode(',', $languages);

shipping.php (https://gitlab.com/shapcy/opencart) PHP · 268 lines

34 }

35

36 if ((utf8_strlen(trim($this->request->post['firstname'])) < 1) || (utf8_strlen(trim($this->request->post['firstname'])) > 32)) {

37 $json['error']['firstname'] = $this->language->get('error_firstname');

38 }

39

40 if ((utf8_strlen(trim($this->request->post['lastname'])) < 1) || (utf8_strlen(trim($this->request->post['lastname'])) > 32)) {

41 $json['error']['lastname'] = $this->language->get('error_lastname');

42 }

43

44 if ((utf8_strlen(trim($this->request->post['address_1'])) < 3) || (utf8_strlen(trim($this->request->post['address_1'])) > 128)) {

45 $json['error']['address_1'] = $this->language->get('error_address_1');

46 }

FaultTest.php (https://github.com/WebTricks/WebTricks-CMS.git) PHP · 297 lines

27 }

28

29 require_once "PHPUnit/Framework/TestCase.php";

30 require_once "PHPUnit/Framework/TestSuite.php";

32 require_once 'Zend/XmlRpc/Server.php';

33 require_once 'Zend/XmlRpc/Server/Fault.php';

34

35 /**

53 public static function main()

54 {

55 require_once "PHPUnit/TextUI/TestRunner.php";

56

57 $suite = new PHPUnit_Framework_TestSuite("Zend_XmlRpc_Server_FaultTest");

248 $fault = Zend_XmlRpc_Server_Fault::getInstance($e);

249

250 $this->assertEquals(trim($xml), trim($fault->__toString()));

251 }

252 }

Type.php (https://bitbucket.org/dnejedly/eaparts.git) PHP · 344 lines

1 <?php

2 /**

3 * Magento

8 * that is bundled with this package in the file LICENSE.txt.

9 * It is also available through the world-wide-web at this URL:

10 * http://opensource.org/licenses/osl-3.0.php

11 * If you did not receive a copy of the license and are unable to

12 * obtain it through the world-wide-web, please send an email

22 * @package Mage_Eav

23 * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)

24 * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)

25 */

26

256 public function getEntityTablePrefix()

257 {

258 $tablePrefix = trim($this->_data['value_table_prefix']);

259

260 if (empty($tablePrefix)) {

S3.php (https://github.com/basdog22/Qool.git) PHP · 332 lines

1 <?php

2 /**

3 * LICENSE

18 */

19

20 require_once 'Zend/Service/Amazon/S3.php';

21 require_once 'Zend/Cloud/StorageService/Adapter.php';

22 require_once 'Zend/Cloud/StorageService/Exception.php';

23

24 /**

319 }

320

321 return trim($bucket) . '/' . trim($path);

322 }

323

submitchoices.php (https://github.com/adivik2000/nigraha.git) PHP · 304 lines

1 <?php

2 $conn = mysql_connect("localhost", "root", "password") or die(mysql_error());

3 mysql_select_db("mnit_profiles", $conn);

200 <td valign="top" bgcolor="#E0E0E0">

201 <p>

202 <?php

203 $count=1;

204 while(isset($_POST['add'.$count])) {

206 $count++;

207 }

208 if (($arr['semester'] == 6) and (isset($_POST['miniproj'])) and (trim($_POST['facultymp']) != ''))

209 $courses[] = trim($_POST['facultymp'])." - MP";

216 <table width="100%" border="0">

217 <tr>

218 <td><font face="Verdana, Arial, Helvetica, sans-serif">Branch: <?php echo $arr['dept'] ?>

219 </font></td>

220

dialog.js (https://gitlab.com/phamngsinh/baitaplon_sinhvien) JavaScript · 244 lines

165 if (isEmpty(interCityInput)) {

166 $("#submit-departure").click(function () {

167 var val = $("#inter-city-departure").val().trim();

168 if (val == '') {

169 $('.error-departure').text('Xin hãy nhập tên thành phố hoặc sân bay để tiếp tục.');

180 });

181 $("#submit-arrival").click(function () {

182 var val = $("#inter-city-arrival").val().trim();

183 if (val == '') {

184 $('.error-arrival').text('Xin hãy nhập tên thành phố hoặc sân bay để tiếp tục.');

Account.php (https://github.com/fan3750060/wpcore.git) PHP · 387 lines

1 <?php

2 namespace app\Common;

3

286

287 $data = [

288 'username' => trim($param[2]),

289 'password' => trim($param[3]),

307

308 $data = [

309 'username' => trim($param[3]),

310 'gmlevel' => (int) $param[4],

311 'RealmID' => (int) $param[5],

InterfaceTypeTestCase.php (https://github.com/railt/railt.git) PHP · 485 lines

1 <?php

2

3 /**

12 namespace Railt\SDL\Tests\Parser\Type;

13

14 use Phplrt\Contracts\Parser\Exception\ParserRuntimeExceptionInterface;

15 use PHPUnit\Framework\Exception;

16 use PHPUnit\Framework\ExpectationFailedException;

17 use Railt\SDL\Frontend\Ast\Definition\ArgumentDefinitionNode;

18 use Railt\SDL\Frontend\Ast\Definition\Type\InterfaceTypeDefinitionNode;

40 $type = $this->interfaceType();

41

42 $this->assertSame('Type description', \trim($type->description->value));

43 }

44

ClientInterface.php (https://gitlab.com/ntphuc/BackendFeedy) PHP · 230 lines

1 <?php

2

3 /*

92 * @method int lrem($key, $count, $value)

93 * @method mixed lset($key, $index, $value)

94 * @method mixed ltrim($key, $start, $stop)

95 * @method string rpop($key)

96 * @method string rpoplpush($source, $destination)

PrettyPrinterAbstract.php (https://gitlab.com/xolotsoft/pumasruiz) PHP · 262 lines

118 * Preprocesses the top-level nodes to initialize pretty printer state.

119 *

120 * @param PHPParser_Node[] $nodes Array of nodes

121 */

122 protected function preprocessNodes(array $nodes) {

133 * Pretty prints an array of nodes (statements) and indents them optionally.

134 *

135 * @param PHPParser_Node[] $nodes Array of nodes

136 * @param bool $indent Whether to indent the printed nodes

137 *

168 }

169

170 protected function pInfixOp($type, PHPParser_Node $leftNode, $operatorString, PHPParser_Node $rightNode) {

171 list($precedence, $associativity) = $this->precedenceMap[$type];

172

FieldHandlerInterface.php (https://gitlab.com/mohamed_hussein/prodt) PHP · 270 lines

1 <?php

2

3 namespace Drupal\views\Plugin\views\field;

229 * The alter array of options to use.

230 * - max_length: Maximum length of the string, the rest gets truncated.

231 * - word_boundary: Trim only on a word boundary.

232 * - ellipsis: Show an ellipsis (…) at the end of the trimmed string.

class-wc-rest-stripe-account-keys-controller.php (https://gitlab.com/campus-academy/krowkaramel) PHP · 232 lines

1 <?php

2 /**

3 * Class WC_REST_Stripe_Account_Keys_Controller

194

195 // If all keys were empty, then is a new account; we need to set the test/live mode.

196 $new_account = ! trim( $settings['publishable_key'] )

197 && ! trim( $settings['secret_key'] )

198 && ! trim( $settings['test_publishable_key'] )

199 && ! trim( $settings['test_secret_key'] );

213 if ( $new_account ) {

214 $settings['enabled'] = 'yes';

215 if ( trim( $settings['publishable_key'] ) && trim( $settings['secret_key'] ) ) {

216 $settings['testmode'] = 'no';

217 } elseif ( trim( $settings['test_publishable_key'] ) && trim( $settings['test_secret_key'] ) ) {

Cookie.php (https://bitbucket.org/vvanuytven/php_auto.git) PHP · 324 lines

1 <?php

2

3 /*

134

135 $values = array(

136 'name' => trim($name),

137 'value' => trim($value),

154

155 foreach ($parts as $part) {

156 $part = trim($part);

157

158 if ('secure' === strtolower($part)) {

196 private static function parseDate($dateValue)

197 {

198 // trim single quotes around date if present

199 if (($length = strlen($dateValue)) > 1 && "'" === $dateValue[0] && "'" === $dateValue[$length-1]) {

200 $dateValue = substr($dateValue, 1, -1);

DirectFilesystem.php (https://github.com/ChuguluGames/mediawiki-svn.git) PHP · 500 lines

1 <?php

2

3 /**

4 * File holding the DirectFilesystem class.

5 *

6 * @file DirectFilesystem.php

7 * @ingroup Deployment

8 * @ingroup Filesystem

16

17 /**

18 * Filesystem class for direct PHP file and folder manipulation.

19 *

20 * @author Jeroen De Dauw

65

66 // Recursive approach required.

67 $file = rtrim( $file, '/' ) . '/';

68 $files = $this->listDir( $file );

69

WCName.php (https://github.com/ChuguluGames/mediawiki-svn.git) PHP · 385 lines

1 <?php

2 /**

3 * Part of WikiCitation extension for Mediawiki.

161 # literal/organizational name

162 if ( $literal ) {

163 # Trim redundant separator characters

164 $chrL = mb_substr( $literal, -1, 1 );

165 $chrR = mb_substr( $endSeparator, 0, 1 );

166 if ( $chrL == $chrR ) {

167 $endSeparator = ltrim( $endSeparator, $chrR );

168 }

169 return WCStyle::makeWikiLink( $link, $literal, WCStyle::nameHTML ) . $endSeparator;

304 }

305

306 # Trim redundant separator characters

307 if ( $post ) {

308 $chrL = mb_substr( $post, -1, 1 );

instructions.rst (https://github.com/lupino3/edumips64.git) ReStructuredText · 626 lines

126 bit specificato nel valore senza segno immediato (positivo compreso tra 0 e

127 63) sa, e pone il risultato in rd. I bit liberi vengono posti a zero se il

128 bit più a sinistra di rs è zero, altrimenti vengono posti a uno.

129

130 * `DSRAV rd, rt, rs`

133 bit specificato nei 6 bit bassi del registro rs che verrà letto come valore

134 senza segno,e pone il risultato in rd. I bit liberi vengono posti a zero se

135 il bit più a sinistra di rs è zero, altrimenti vengono posti a uno.

136

137 * `DSRL rd, rs, sa`

210 bit specificato nel valore immediato (positivo compreso tra 0 e 63) sa, e

211 pone il risultato nel registro a 32-bit rd. I bit liberi vengono posti a

212 zero se il bit più a sinistra di rs è zero, altrimenti vengono posti

213 a uno.

214

multisite.py (https://github.com/OpenMPDK/KVCeph.git) Python · 387 lines

73 if r == 0:

74 output = s.decode('utf-8')

75 output = output[output.find('{'):] # trim extra output before json

76 data = json.loads(output)

77 self.load_from_json(data)

TextDataTest.php (https://gitlab.com/Zinnurain/destination_finder_beta) PHP · 365 lines

13 define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');

14 }

15 require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');

16

17 PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL);

249 $args = func_get_args();

250 $expectedResult = array_pop($args);

251 $result = call_user_func_array(array('PHPExcel_Calculation_TextData','TRIMSPACES'),$args);

252 $this->assertEquals($expectedResult, $result);

253 }

265 $args = func_get_args();

266 $expectedResult = array_pop($args);

267 $result = call_user_func_array(array('PHPExcel_Calculation_TextData','TRIMNONPRINTABLE'),$args);

268 $this->assertEquals($expectedResult, $result);

269 }

StringTable.php (https://github.com/abgreeve/moodle.git) PHP · 282 lines

1 <?php

2

3 namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx;

4

5 use PhpOffice\PhpSpreadsheet\Cell\DataType;

6 use PhpOffice\PhpSpreadsheet\RichText\RichText;

7 use PhpOffice\PhpSpreadsheet\RichText\Run;

8 use PhpOffice\PhpSpreadsheet\Shared\StringHelper;

9 use PhpOffice\PhpSpreadsheet\Shared\XMLWriter;

10 use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;

11

12 class StringTable extends WriterPart

files.php (https://gitlab.com/webbroteam/satisfaction-mvc) PHP · 306 lines

13 */

14

15 namespace phpFastCache\Drivers;

16

17 use phpFastCache\Core\DriverAbstract;

18 use phpFastCache\Exceptions\phpFastCacheDriverException;

19

20 /**

28 * phpFastCache_files constructor.

29 * @param array $config

30 * @throws phpFastCacheDriverException

31 */

32 public function __construct($config = array())

57 * @param bool $skip

58 * @return string

59 * @throws phpFastCacheDriverException

60 */

61 private function getFilePath($keyword, $skip = false)

vid_camara_axispresetpos.control.php (https://gitlab.com/talueses/SIPVE) PHP · 221 lines

183 //------------------------------------------------------------------------------------------------------------//

184 $datoName = "idcamara";

185 $dato = (isset($_REQUEST[$datoName]) && trim($_REQUEST[$datoName])!=='')? trim($_REQUEST[$datoName]) : null;

186 if($dato===null){

187 $this->mensaje = "Falta introducir el campo ".$this->getCampos($datoName)." ";

194 //------------------------------------------------------------------------------------------------------------//

195 $datoName = "presetnbr";

196 $dato = (isset($_REQUEST[$datoName]) && trim($_REQUEST[$datoName])!=='')? trim($_REQUEST[$datoName]) : null;

197 if($dato===null){

198 $this->mensaje = "Falta introducir el campo ".$this->getCampos($datoName)." ";

205 //------------------------------------------------------------------------------------------------------------//

206 $datoName = "presetname";

207 $dato = (isset($_REQUEST[$datoName]) && trim($_REQUEST[$datoName])!=='')? trim($_REQUEST[$datoName]) : null;

208 if($dato===null){

209 $this->mensaje = "Falta introducir el campo ".$this->getCampos($datoName)." ";

DocBlockScanner.php (https://gitlab.com/yousafsyed/easternglamor) PHP · 326 lines

1 <?php

2 /**

3 * Zend Framework (http://framework.zend.com/)

169 SCANNER_END:

170

171 $this->shortDescription = trim($this->shortDescription);

172 $this->longDescription = trim($this->longDescription);

Message.php (https://github.com/Exercise/zf2.git) PHP · 283 lines

1 <?php

2 /**

3 * Zend Framework

153 }

154

155 return trim($body);

156 }

157

259 break;

260 case 'content-id':

261 $newPart->id = trim($value,'<>');

262 break;

263 case 'content-disposition':

Candidato.php (https://bitbucket.org/brunobispo/webgoal-vagas-api.git) PHP · 425 lines

1 <?php

2

3 /**

272 ),

273 'filters' => array(

274 array('name' => 'StringTrim')

275 )

276 )));

280 'required' => true,

281 'filters' => array(

282 array('name' => 'Zend\Filter\StringTrim'),

283 ),

284 'validators' => array(

310 ),

311 'filters' => array(

312 array('name' => 'StringTrim'),

313 ),

314 )));

Admin.php (https://gitlab.com/sdlion/project_the_beginner_b35) PHP · 234 lines

1 <?php

2 namespace App\Admin;

3

140 $STH = $this->conn->prepare($sql);

141 $STH->execute($arrData);

142 Utility::redirect('index.php');

143 }

144 public function delete()

153 Message::message("Failed!Data has been deleted successfully");

154

155 Utility::redirect('index.php');

156 }

157

181 $allData= $STH->fetchAll();

182 foreach ($allData as $oneData) {

183 $_allKeywords[] = trim($oneData->doctor_name);

184 }

185

ScreenshotHelper.cs (https://hg01.codeplex.com/d3future) C# · 206 lines ✨ Summary

This C# code provides a set of utility methods for capturing and saving screenshots of UI elements, including entire windows and individual elements. It supports various image formats (bmp, jpg, gif, png, tiff) and allows saving to streams or files. The code also handles cases where the screenshot cannot be saved due to errors or file existence issues.

125

126 BitmapEncoder encoder = ScreenshotHelper.GetEncoderByExtension(fileExtension);

127 encoder.Frames.Add(BitmapFrame.Create(bitmap, null, new BitmapMetadata(fileExtension.Trim('.')), null));

128 encoder.Save(stream);

129 }

152 using (FileStream fs = new FileStream(filePath, FileMode.Create, FileAccess.Write))

153 {

154 string extension = System.IO.Path.GetExtension(filePath).TrimStart('.');

155 SaveBitmapToStream(bitmap, fs, extension);

156 }

183 using (FileStream fs = new FileStream(filePath, FileMode.Create, FileAccess.Write))

184 {

185 string extension = System.IO.Path.GetExtension(filePath).TrimStart('.');

186 if (stream.CanSeek)

187 stream.Seek(0, SeekOrigin.Begin);

Converter.php (https://gitlab.com/yousafsyed/easternglamor) PHP · 323 lines

1 <?php

2 /**

3 * Copyright © 2016 Magento. All rights reserved.

161

162 foreach ($matches['value'] as $matchKey => $matchValue) {

163 $callback = "matcher" . ucfirst(trim($matches['type'][$matchKey]));

164 $matchResult = call_user_func_array([$this, $callback], [$matchValue]);

165 if (!empty($matchResult)) {

Model-suite.js (git://github.com/petermichaux/maria.git) JavaScript · 408 lines

189 },

190

191 "test maria.mixinStringAttribute trim": function () {

192 var m = new maria.Model();

193 maria.mixinStringAttribute(m, 'color', {

194 'default': 'red',

195 trim: true

196 });

197

MethodScanner.php (https://github.com/brazza/zf2.git) PHP · 342 lines

1 <?php

2

3 namespace Zend\Code\Scanner;

295 }

296 if ($tokenType === T_VARIABLE) {

297 $infos[$infoIndex]['name'] = ltrim($tokenContent, '$');

298 }

299 }

String.cs (https://bitbucket.org/pmfsampaio/netmf-lpc.git) C# · 269 lines

80

81 [MethodImplAttribute(MethodImplOptions.InternalCall)]

82 public extern String Trim(params char[] trimChars);

83

84 [MethodImplAttribute(MethodImplOptions.InternalCall)]

85 public extern String TrimStart(params char[] trimChars);

86

87 [MethodImplAttribute(MethodImplOptions.InternalCall)]

88 public extern String TrimEnd(params char[] trimChars);

89

90 [MethodImplAttribute(MethodImplOptions.InternalCall)]

Uses.php (https://github.com/studioskylab/Docblox.git) PHP · 175 lines

1 <?php

2 /**

3 * DocBlox

4 *

5 * PHP 5

6 *

7 * @category DocBlox

9 * @subpackage Behaviour

10 * @author Mike van Riel <mike.vanriel@naenius.com>

11 * @license http://www.opensource.org/licenses/mit-license.php MIT

12 * @link http://docblox-project.org

13 */

20 * @subpackage Behaviour

21 * @author Mike van Riel <mike.vanriel@naenius.com>

22 * @license http://www.opensource.org/licenses/mit-license.php MIT

23 * @link http://docblox-project.org

24 */

espanol.clj (https://github.com/franksfo/italianquiz.git) Clojure · 1124 lines

4 (require '[clojure.core :as core])

5 (require '[clojure.string :as string])

6 (require '[clojure.string :refer (trim)])

7 (require '[clojure.tools.logging :as log])

8 (require '[italianverbs.stringutils :refer :all])

79 (= :top (get-in word '(:b :agr :number) :none)))

80 )

81 (str (string/trim (get-in word '(:a :espanol)))

82 " "

83 (string/trim (get-in word '(:b :espanol))))

89 (= :top (get-in word '(:b :agr :number) :none)))

90 )

91 (str (string/trim (get-in word '(:a)))

92 " "

93 (string/trim (get-in word '(:b :espanol))))

tcl.xml (https://jedit.svn.sourceforge.net/svnroot/jedit) XML · 458 lines

246 <KEYWORD3>tolower</KEYWORD3>

247 <KEYWORD3>toupper</KEYWORD3>

248 <KEYWORD3>trim</KEYWORD3>

249 <KEYWORD3>trimleft</KEYWORD3>

250 <KEYWORD3>trimright</KEYWORD3>

251 <KEYWORD3>type</KEYWORD3>

252 <KEYWORD3>uid</KEYWORD3>

StatementSimpleStatementTest.cs (https://hg01.codeplex.com/linqtoroot) C# · 119 lines ✨ Summary

This C# code defines a set of unit tests for a StatementSimpleStatement class, which appears to be part of a LINQ-to-TTree library. The tests cover various scenarios, including constructor initialization, method calls, and exception handling, ensuring the class behaves correctly under different conditions.

45 Assert.IsFalse(target.Line.EndsWith(";"), "semicolon should have been stripped off ('" + target.Line + "')");

46 Assert.AreNotEqual(0, target.Line, "empty line is not allowed");

47 line = line.Trim();

48 while (line.EndsWith(";"))

49 {

50 line = line.Substring(0, line.Length - 1);

51 line = line.Trim();

52 }

53 Assert.AreEqual(line, target.Line, "bad line set");

MavenUtil.java (https://bitbucket.org/nbargnesi/idea.git) Java · 726 lines

383

384 public static <T extends Collection<Pattern>> T collectPattern(String text, T result) {

385 String antPattern = FileUtil.convertAntToRegexp(text.trim());

386 try {

387 result.add(Pattern.compile(antPattern));

595

596 public static boolean isEmptyOrSpaces(@Nullable String str) {

597 return str == null || str.length() == 0 || str.trim().length() == 0;

598 }

599

OpenItPlugin.java (https://jedit.svn.sourceforge.net/svnroot/jedit) Java · 254 lines ✨ Summary

This Java code is for an OpenIt plugin for the jEdit text editor. It provides functionality to manage source paths, find files within those paths, and add directories to the source path. The plugin also handles view updates, shutdown, and option pane creation. It uses a map to store listeners for file selection and find windows for each view.

192 // append the new path to the end of the sourcepath property

193 String stringSourcePath = jEdit.getProperty(OpenItProperties.SOURCE_PATH_STRING, "");

194 stringSourcePath = (stringSourcePath.trim().endsWith(File.pathSeparator) ?

195 stringSourcePath + path : stringSourcePath + File.pathSeparator + path);

196 jEdit.setProperty(OpenItProperties.SOURCE_PATH_STRING, stringSourcePath);

SimpleAntBridge.java (https://jedit.svn.sourceforge.net/svnroot/jedit) Java · 315 lines ✨ Summary

This Java class, SimpleAntBridge, is an implementation of an Ant build utility plugin for jEdit. It provides a bridge between Ant and jEdit, allowing users to execute Ant targets within the jEdit editor. The class logs events and errors to an output stream, and can be configured with a specific build file.

223 fireBuildStarted();

224

225 if (targetName == null || targetName.trim().length() == 0)

226 {

227 targetName = project.getDefaultTarget();

contacts.php (https://bitbucket.org/kraymitchell/fcd.git) PHP · 159 lines

1 <?php

2 /**

3 * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.

75 }

76

77 $text = trim($text);

78 if ($text == '') {

79 return array();

147 if ($rows) {

148 foreach($rows as $key => $row) {

149 $rows[$key]->href = 'index.php?option=com_contact&view=contact&id='.$row->slug.'&catid='.$row->catslug;

150 $rows[$key]->text = $row->title;

151 $rows[$key]->text .= ($row->con_position) ? ', '.$row->con_position : '';

XMLViewer.js (https://bitbucket.org/ultra_iter/qt-vtl.git) JavaScript · 434 lines

219 // Processing utils.

220

221 function trim(value)

222 {

223 return value.replace(/^\s\s*/, '').replace(/\s\s*$/, '');

226 function isShort(value)

227 {

228 return trim(value).length <= 50;

229 }

230

298 {

299 var text = createHTMLElement('span');

300 text.textContent = trim(value);

301 text.classList.add('text');

302 return text;

AStyle.java (https://jedit.svn.sourceforge.net/svnroot/jedit) Java · 694 lines ✨ Summary

This is a help message for an AStyle command-line tool, explaining its options and usage. It provides detailed information on various formatting and configuration options, including file naming conventions, error handling, and version control. The output explains how to use the tool, what options are available, and where default settings can be found.

482 }

483 } while (!eof);

484 String currentToken = currentTokenBuf.toString().trim();

485 if (currentToken.length() != 0) {

486 optionsVector.addElement(currentToken);

CreateExternalAction.java (https://bitbucket.org/nbargnesi/idea.git) Java · 179 lines

72 final String url = dialog.getSelectedURL();

73 final boolean checkout = dialog.isCheckout();

74 final String target = dialog.getLocalTarget().trim();

75

76 ProgressManager.getInstance().run(new Task.Backgroundable(project, "Creating External", true, null) {

PhpEvalTask.php (git://github.com/alexgorbatchev/SyntaxHighlighter.git) text · 0 lines

1 <?php

2 /*

3 * $Id: PhpEvalTask.php 144 2007-02-05 15:19:00Z hans $

4 *

5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS

20 */

21

22 require_once 'phing/Task.php';

23

24 /**

55

56 if ($this->expression !== null && !empty($this->params)) {

57 throw new BuildException("You cannot use nested <param> tags when evaluationg a PHP expression.", $this->location);

58 }

59

StatusBar.java (https://jedit.svn.sourceforge.net/svnroot/jedit) Java · 498 lines ✨ Summary

This Java code is part of a text editor’s status bar, displaying various widgets such as mode, encoding, and caret position information. It updates these widgets based on user interactions and displays them in a customizable layout. The code also includes event handling for mouse clicks and keyboard input to provide interactive functionality.

200 {

201 // don't obscure existing message

202 if(message != null && !"".equals(message.getText().trim())

203 && !currentMessageIsIO)

204 return;

admin-ajax.php (https://bitbucket.org/simplemediacode/bptrunk.git) PHP · 264 lines

1 <?php

2

3 define( 'BB_IS_ADMIN', true );

4 define( 'DOING_AJAX', true );

5

6 require_once('../bb-load.php');

7

8 if ( !class_exists( 'WP_Ajax_Response' ) )

9 require_once( BACKPRESS_PATH . 'class.wp-ajax-response.php' );

10

11 require_once( BB_PATH . 'bb-admin/includes/functions.bb-admin.php' );

150 $topic_id = (int) $_POST['topic_id'];

151 $last_mod = (int) $_POST['last_mod'];

152 if ( !$post_content = trim($_POST['post_content']) )

153 $error = new WP_Error( 'no-content', __('You need to actually submit some content!') );

154 if ( !bb_current_user_can( 'write_post', $topic_id ) )

rebol.xml (https://jedit.svn.sourceforge.net/svnroot/jedit) XML · 547 lines

92 <KEYWORD1>third</KEYWORD1>

93 <KEYWORD1>to</KEYWORD1>

94 <KEYWORD1>trim</KEYWORD1>

95 <KEYWORD1>xor~</KEYWORD1>

96 <KEYWORD1>alias</KEYWORD1>

NavHistoryPopup.java (https://jedit.svn.sourceforge.net/svnroot/jedit) Java · 415 lines ✨ Summary

This Java code is part of a text editor’s navigator component, responsible for displaying line numbers and syntax highlighted code snippets. It uses a custom CellRenderer to render each line in the navigator, which includes highlighting the line with proper syntax coloring based on the surrounding code. The renderer also displays additional information such as file paths and line numbers.

393 // add on the path, followed by the syntax highlighted line. The line number

394 // is provided by code2html, that's why the useGutter property is set to true.

395 labelText = "<html><tt>" + pos.path + ":</tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + labelText.trim() ;

396 }

397 }

EditorHistoryManager.java (https://bitbucket.org/nbargnesi/idea.git) Java · 365 lines

94 }

95 }

96 trimToSize();

97 }

98 }

159 }

160 myEntriesList.add(new HistoryEntry(file, providers, states, providers[selectedProviderIndex]));

161 trimToSize();

162 }

163 }

305 * then removes the oldest ones to fit the history to new size.

306 */

307 private void trimToSize(){

308 final int limit = UISettings.getInstance().RECENT_FILES_LIMIT + 1;

309 while(myEntriesList.size()>limit){

NoWrapCellRenderer.java (https://jedit.svn.sourceforge.net/svnroot/jedit) Java · 27 lines ✨ Summary

This Java code defines a custom cell renderer for a table component, specifically designed to display text from a JTable with non-wrapping behavior. It sets the background and foreground colors based on selection state and returns the rendered component. The renderer is used in an SVN GUI plugin.

19

20 public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column ) {

21 setText( value == null ? "" : value.toString().trim() );

22 setBackground( isSelected ? selection : background );

23 setForeground( foreground );

HtmlParser.jj (https://jedit.svn.sourceforge.net/svnroot/jedit) Unknown · 620 lines

88 document.setLineSeparator("\n");

89 document.accept(new HtmlCollector());

90 document.accept(new HtmlScrubber(HtmlScrubber.DEFAULT_OPTIONS | HtmlScrubber.TRIM_SPACES));

91 HtmlFormatter formatter = new HtmlFormatter();

92 formatter.setRightMargin(1024);

608 sb.append(jj_input_stream.readChar());

609 if (sb.length() > 2 && sb.substring(sb.length() - 2).equals("%>")) {

610 // trim the %> from the end of the string

611 sb.setLength(sb.length() - 2);

612 return sb.toString();

progress.xml (https://jedit.svn.sourceforge.net/svnroot/jedit) XML · 1060 lines

969 <FUNCTION>LDBNAME</FUNCTION>

970 <FUNCTION>LE</FUNCTION>

971 <FUNCTION>LEFT-TRIM</FUNCTION>

972 <FUNCTION>LENGTH</FUNCTION>

973 <FUNCTION>LIBRARY</FUNCTION>

coldfusion.xml (https://jedit.svn.sourceforge.net/svnroot/jedit) XML · 645 lines

336 <FUNCTION>Len</FUNCTION>

337 <FUNCTION>LJustify</FUNCTION>

338 <FUNCTION>LTrim</FUNCTION>

339 <FUNCTION>Mid</FUNCTION>

340 <FUNCTION>REFind</FUNCTION>

350 <FUNCTION>Right</FUNCTION>

351 <FUNCTION>RJustify</FUNCTION>

352 <FUNCTION>RTrim</FUNCTION>

353 <FUNCTION>SpanExcluding</FUNCTION>

354 <FUNCTION>SpanIncluding</FUNCTION>

355 <FUNCTION>Trim</FUNCTION>

356 <FUNCTION>UCase</FUNCTION>

357 <FUNCTION>Val</FUNCTION>

BibTeXParser.java (https://jedit.svn.sourceforge.net/svnroot/jedit) Java · 258 lines ✨ Summary

This Java code is a BibTeX parser for LaTeX documents. It analyzes the document’s bibliography section to extract and parse bibliographic entries, including author, title, journal, and reference information. The parsed data is stored in an ArrayList of BibEntry objects, which can be accessed through various methods.

143 while (st.hasMoreTokens()) {

144

145 String s = st.nextToken().trim();

146

147 if (!s.endsWith(".bib")) {

221 int refEnd = line.indexOf("}");

222 String bibRef = line.substring(refStart + 9, refEnd);

223 BibEntry be = new BibEntry(bibRef.trim(), "", "");

224 bibEntries.add(be);

225 }

inputpage.cpp (https://bitbucket.org/ultra_iter/qt-vtl.git) C++ · 103 lines

82 bool InputPage::validatePage()

83 {

84 QFile f(m_ui.fileLineEdit->text().trimmed());

85 if (!f.exists() || !f.open(QIODevice::ReadOnly)) {

86 QMessageBox::critical(this, tr("File Open Error"),

BuildMessage.java (https://jedit.svn.sourceforge.net/svnroot/jedit) Java · 206 lines ✨ Summary

This Java code defines a class BuildMessage that represents a message related to building a project, such as compiling or running an error. It can parse messages and extract relevant information like target file, line number, and type (exception or build). The getBuildMessage method attempts to determine the type of message based on its content and returns a corresponding BuildMessage object.

113 }

114

115 String trimmed = message.trim();

116

117 int start = trimmed.indexOf(" ") + 1;

118 int end = trimmed.indexOf("(");

119

120 String classname = trimmed.substring( start, end );

170

171

172 if ( message.trim().length() >= 2 && message.trim().substring(0, 2).equals("at") ) {

173 return TYPE_EXCEPTION;

174 }

OutputToGeneralTestEventsConverter.java (https://bitbucket.org/nbargnesi/idea.git) Java · 503 lines

134 final ServiceMessageVisitor visitor) throws ParseException {

135 // service message parser expects line like "##teamcity[ .... ]" without whitespaces in the end.

136 final ServiceMessage message = ServiceMessage.parse(text.trim());

137 if (message != null) {

138 message.visit(visitor);

Make_Get_and_Set_Methods.bsh (https://jedit.svn.sourceforge.net/svnroot/jedit) Unknown · 337 lines

188 System.out.println("1");

189 // remove leading and trailing whitespace

190 lineText = lineText.trim();

191 if ( lineText.length() == 0 ) {

192 continue; // nothing to do with this line

203 }

204 System.out.println("3");

205 lineText = lineText.trim();

206 if ( lineText.length() == 0 ) {

207 continue;

218 String back = lineText.substring( index ); // remaining variable names

219 lineText = front.substring( 0, front.lastIndexOf( " " ) ); // adjust remaining line text, this contains the type

220 front = front.substring( front.lastIndexOf( " " ) ).trim(); // first variable name

221 String[] backs = back.split( "," ); // remaining variable names

222 variables.add( front ); // add first variable name to the list

posts.php (https://bitbucket.org/simplemediacode/bptrunk.git) PHP · 195 lines

9 $count = 0;

10

11 $action = trim( $_POST['action'] );

12

13 switch ( $action ) {

79 <div class="wrap">

80

81 <h2><?php _e( 'Posts' ); ?>

82 <?php

143 <?php foreach ( $bulk_actions as $value => $label ) : ?>

144

145 <option value="<?php echo esc_attr( $value ); ?>"><?php echo esc_html( $label ); ?></option>

146 <?php endforeach; ?>

147 </select>

148 <input type="submit" value="<?php esc_attr_e( 'Apply' ); ?>" class="button submit-input" />

149 <?php bb_nonce_field( 'post-bulk' ); ?>

Make_Get_and_Set_Methods.bsh (https://jedit.svn.sourceforge.net/svnroot/jedit) Unknown · 321 lines

221 return this;

222 }

223 line = mainTextArea.getLineText(mainTextArea.getCaretLine()).trim();

224 if(!(line == null || line.equals("")))

225 {

vbscript.xml (https://jedit.svn.sourceforge.net/svnroot/jedit) XML · 740 lines

348 <KEYWORD2>string</KEYWORD2>

349 <KEYWORD2>strreverse</KEYWORD2>

350 <KEYWORD2>ltrim</KEYWORD2>

351 <KEYWORD2>rtrim</KEYWORD2>

352 <KEYWORD2>trim</KEYWORD2>

353 <!-- Variants -->

354 <KEYWORD2>isarray</KEYWORD2>

SaveMetaTargetDialog.java (https://bitbucket.org/nbargnesi/idea.git) Java · 153 lines

148 }

149 final ExecuteCompositeTargetEvent event = new ExecuteCompositeTargetEvent(names);

150 event.setPresentableName(myTfName.getText().trim());

151 return event;

152 }

base2.js (http://enginey.googlecode.com/svn/trunk/) JavaScript · 973 lines ✨ Summary

This JavaScript code defines a set of modules and namespaces for a programming language, including Base, Abstract, Module, Enumerable, Array2, Hash, Collection, RegGrp, and Namespace. It sets up the namespace hierarchy and exports functions from each module. The code also includes some utility functions like extend and format.

196 };

197

198 var TRIM = /^\s+|\s+$/g;

199 var trim = function(string) {

200 return String(string).replace(TRIM, "");

201 };

202

950 name: "lang",

951 version: base2.version,

952 exports: "K,assert,assertType,assignID,instanceOf,extend,format,forEach,match,rescape,slice,trim",

953

954 init: function() {

sas.xml (https://jedit.svn.sourceforge.net/svnroot/jedit) XML · 442 lines

413 <KEYWORD2>TO</KEYWORD2>

414 <KEYWORD2>TOL</KEYWORD2>

415 <KEYWORD2>TRIM</KEYWORD2>

416 <KEYWORD2>UNFORMATTED</KEYWORD2>

417 <KEYWORD2>UNTIL</KEYWORD2>

pl-sql.xml (https://jedit.svn.sourceforge.net/svnroot/jedit) XML · 503 lines

382 <KEYWORD2>LOWER</KEYWORD2>

383 <KEYWORD2>LPAD</KEYWORD2>

384 <KEYWORD2>LTRIM</KEYWORD2>

385 <KEYWORD2>MOD</KEYWORD2>

386 <KEYWORD2>MONTHS_BETWEEN</KEYWORD2>

398 <KEYWORD2>ROWIDTOCHAR</KEYWORD2>

399 <KEYWORD2>RPAD</KEYWORD2>

400 <KEYWORD2>RTRIM</KEYWORD2>

401 <KEYWORD2>SIGN</KEYWORD2>

402 <KEYWORD2>SOUNDEX</KEYWORD2>

tsql.xml (https://jedit.svn.sourceforge.net/svnroot/jedit) XML · 1020 lines

391 <KEYWORD2>LOG</KEYWORD2>

392 <KEYWORD2>LOWER</KEYWORD2>

393 <KEYWORD2>LTRIM</KEYWORD2>

394 <KEYWORD2>MONTH</KEYWORD2>

395 <KEYWORD2>NEWID</KEYWORD2>

412 <KEYWORD2>ROUND</KEYWORD2>

413 <KEYWORD2>ROWCOUNT_BIG</KEYWORD2>

414 <KEYWORD2>RTRIM</KEYWORD2>

415 <KEYWORD2>SCOPE_IDENTITY</KEYWORD2>

416 <KEYWORD2>SERVERPROPERTY</KEYWORD2>

ASBeautifier.java (https://jedit.svn.sourceforge.net/svnroot/jedit) Java · 1865 lines ✨ Summary

This Java code appears to be a part of a C/C++ preprocessor, specifically handling variable and function declarations. It checks for valid characters in identifiers, handles header detection, and manages indentation levels during parsing. The code seems to be designed to ensure that the output is syntactically correct and follows standard C/C++ conventions.

615 leadingWhiteSpaces++;

616

617 line = originalLine.trim();

618 } else {

619 int trimSize;

620 for (trimSize = 0;

621 trimSize < originalLine.length() && trimSize < leadingWhiteSpaces && originalLine.charAt(trimSize) <= 0x20;

622 trimSize++)

623 ;

624 line = originalLine.substring(trimSize);

625 }

626

634 if (isCStyle && !isInComment && (line.charAt(0) == '#' || backslashEndsPrevLine)) {

635 if (line.charAt(0) == '#') {

636 String preproc = line.substring(1).trim();

637 // When finding a multi-lined #define statement, the original beautifier

638 // 1. sets its isInDefineDefinition flag

BibTeXPanel.java (https://jedit.svn.sourceforge.net/svnroot/jedit) Java · 428 lines ✨ Summary

This Java code is a part of a LaTeX bibliography management system for a text editor. It loads and processes bibliographic data from LaTeX files, extracting references and titles to create a list of citations that can be used in the document. The code also allows users to add referenced BibTeX files to a list and sorts them alphabetically by reference title.

217

218 // log("entry: " + rm.toString(1));

219 BibEntry bibEntry = new BibEntry(bibref.trim(),

220 rm.toString(1).trim());

282 while (st.hasMoreTokens()) {

283

284 String s = st.nextToken().trim();

285

286 if (!s.endsWith(".bib"))

320 int refEnd = line.indexOf("}");

321 String bibRef = line.substring(refStart + 9, refEnd);

322 BibEntry be = new BibEntry(bibRef.trim(), "");

323 bibEntries.add(be);

324 }

JavaCCParserTokenManager.java (https://jedit.svn.sourceforge.net/svnroot/jedit) Java · 2045 lines ✨ Summary

This Java code is part of a lexical analyzer (tokenizer) for a parser, responsible for breaking input text into individual tokens. It manages the parsing process by switching between different states and handling various token types, including special tokens. The code uses a finite state machine to parse the input stream and generate tokens.

43 }

44

45 static void trim() {

46 if (a.size() == 0)

47 return;

57 }

58

59 static void trimNL() {

60 if(outputBuffer.length() > 0 && outputBuffer.charAt(outputBuffer.length() - 1) == '\u005cn')

61 outputBuffer.deleteCharAt(outputBuffer.length() - 1);

64 }

65

66 static void trimNL(String s) {

67 StringBuffer sb = new StringBuffer(s);

68 while(sb.length() > 0 && (sb.charAt(sb.length() - 1) == '\u005cr' || sb.charAt(sb.length() - 1) == '\u005cn'))

pdx7.adsr~.pd (git://github.com/pd-projects/pdx7.git) Unknown · 427 lines

207 #N canvas 0 0 590 606 colorize 0;

208 #X obj 69 339 list prepend color;

209 #X obj 69 362 list trim;

210 #N canvas 281 345 447 195 rgbtopd 0;

211 #X obj 35 59 expr -65536 * $i1 - 256 * $i2 - $i3 - 1 \;;

363 #X obj 69 386 outlet;

364 #X obj 211 341 list prepend color;

365 #X obj 211 364 list trim;

366 #X obj 211 388 outlet;

367 #X obj 356 343 list prepend color;

368 #X obj 356 366 list trim;

369 #X obj 356 390 outlet;

370 #X obj 69 33 inlet;

coldfusion.xml (https://jedit.svn.sourceforge.net/svnroot/jedit) XML · 358 lines

287 <KEYWORD2>Len</KEYWORD2>

288 <KEYWORD2>LJustify</KEYWORD2>

289 <KEYWORD2>LTrim</KEYWORD2>

290 <KEYWORD2>Mid</KEYWORD2>

291 <KEYWORD2>REFind</KEYWORD2>

301 <KEYWORD2>Right</KEYWORD2>

302 <KEYWORD2>RJustify</KEYWORD2>

303 <KEYWORD2>RTrim</KEYWORD2>

304 <KEYWORD2>SpanExcluding</KEYWORD2>

305 <KEYWORD2>SpanIncluding</KEYWORD2>

306 <KEYWORD2>Trim</KEYWORD2>

307 <KEYWORD2>UCase</KEYWORD2>

308 <KEYWORD2>Val</KEYWORD2>

da903x_bl.c (http://omnia2droid.googlecode.com/svn/trunk/) C · 204 lines ✨ Summary

This C code implements a backlight driver for Dialog Semiconductor DA9030/DA9034 devices. It provides functions to set and update the brightness of the backlight, as well as register and unregister the device with the Linux kernel. The driver is designed to work with various backlight controllers and can be used in different platforms.

22 #define DA9030_WLED_CONTROL 0x25

23 #define DA9030_WLED_CP_EN (1 << 6)

24 #define DA9030_WLED_TRIM(x) ((x) & 0x7)

25

26 #define DA9034_WLED_CONTROL1 0x3C

63 break;

64 case DA9030_ID_WLED:

65 val = DA9030_WLED_TRIM(brightness);

66 val |= brightness ? DA9030_WLED_CP_EN : 0;

67 ret = da903x_write(dev, DA9030_WLED_CONTROL, val);

JCompilerShell.java (https://jedit.svn.sourceforge.net/svnroot/jedit) Java · 236 lines ✨ Summary

This Java code implements a shell for the JCompiler plugin, allowing users to interact with the compiler through a console interface. It handles commands such as compiling, rebuilding packages, and executing javac commands, while also providing error handling and output management. The shell is designed to work within the JEdit text editor environment.

87 stop(console); // stop last command

88

89 String cmd = command.trim();

90 DefaultErrorSource errorSource = console.getErrorSource();

91

nsViewSourceHTML.h (git://github.com/zpao/v8monkey.git) C Header · 167 lines ✨ Summary

This C++ header file defines a class CViewSourceHTML that generates HTML content based on a given input. It includes features like syntax highlighting, tokenization, and entity expansion. The class is designed to work with Mozilla’s HTML parser and provides methods for writing tags, attributes, and text content. It also handles errors and verification of the context stack.

123 const nsAString& text, nsTokenAllocator* allocator,

124 const nsAString& attrName, const nsAString& attrValue);

125 const nsDependentSubstring TrimTokenValue(const nsAString& tokenValue);

126 void TrimTokenValue(nsAString::const_iterator& start,

127 nsAString::const_iterator& end);

128 bool IsTokenValueTrimmableCharacter(PRUnichar ch);

129 nsresult GetBaseURI(nsIURI **result);

130 nsresult SetBaseURI(const nsAString& baseSpec);

ProjectPropertiesPane.java (https://jedit.svn.sourceforge.net/svnroot/jedit) Java · 336 lines ✨ Summary

This Java code defines a GUI dialog for managing project settings, including name, root path, URL root (for web projects), and parent group. The dialog has buttons to choose the root path and select a parent group from a list of available groups. When the user clicks “OK”, the dialog validates the input and updates the project settings accordingly.

111 chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);

112

113 String root = projRoot.getText().trim();

114 if (root.length() > 0) {

115 chooser.setSelectedFile(new File(root));

157 /** Updates the project with the info supplied by the user. */

158 protected void _save() {

159 String name = projName.getText().trim();

160 ok = true;

161

180 }

181

182 String root = projRoot.getText().trim();

183 if (root.length() == 0) {

184 JOptionPane.showMessageDialog(

HistoryModel.java (https://jedit.svn.sourceforge.net/svnroot/jedit) Java · 320 lines ✨ Summary

This Java class, HistoryModel, is a list model for storing and managing a history of text input. It allows multiple instances to be created with unique names, and provides methods for adding, retrieving, and saving entries in the history. The data is stored in a vector and can be loaded from a file when the application starts.

53 //{{{ addItem() method

54 /**

55 * Adds an item to the end of this history list, trimming the list

56 * to the maximum number of items if necessary.

57 * @param text The item

FileTypeUtil.java (https://bitbucket.org/nbargnesi/idea.git) Java · 434 lines

158 for (String line : lines)

159 {

160 if (options.isTrim()) {

161 line = line.trim();

162 }

163 line = StringUtil.trimStart(StringUtil.trimStart(line, pre.toString()), open);

164 line = StringUtil.trimEnd(line, close);

RE.java (https://jedit.svn.sourceforge.net/svnroot/jedit) Java · 1357 lines ✨ Summary

This Java code is part of a regular expression compiler, responsible for parsing and compiling regular expressions into an internal representation. It handles various input types, including strings, character arrays, and streams, and provides methods for debugging and human-readable output. The compiled regular expression can be used to match patterns in text data.

466 // Create a new RETokenOneOf

467 addToken(currentToken);

468 options.trimToSize();

469 currentToken = new RETokenOneOf(subIndex,options,negative);

470 }

779 if (branches != null) {

780 branches.addElement(new RE(firstToken,lastToken,numSubs,subIndex,minimumLength));

781 branches.trimToSize(); // compact the Vector

782 minimumLength = 0;

783 firstToken = lastToken = null;

parse_conf.c (https://bitbucket.org/freebsd/freebsd-head/) C · 176 lines ✨ Summary

This C code defines a configuration module for reference clocks, specifically for use with the NTP (Network Time Protocol) system. It includes various clock formats and definitions, as well as copyright information and licensing terms. The code is part of a larger project and appears to be a kernel module or library component.

69 #endif

70

71 #ifdef CLOCK_TRIMTAIP

72 extern clockformat_t clock_trimtaip;

73 #endif

74

75 #ifdef CLOCK_TRIMTSIP

76 extern clockformat_t clock_trimtsip;

116 &clock_rawdcf,

117 #endif

118 #ifdef CLOCK_TRIMTAIP

119 &clock_trimtaip,

120 #endif

121 #ifdef CLOCK_TRIMTSIP

122 &clock_trimtsip,

RemoteClient.java (https://jedit.svn.sourceforge.net/svnroot/jedit) Java · 235 lines ✨ Summary

This Java code defines a RemoteClient class that establishes a connection to a remote server and allows for sending and receiving messages. It handles incoming messages, registers and unregisters message types, and sends objects as serialized data. The client also includes a welcome service and supports various command handlers for processing incoming commands.

135 if (builder.length() != 0)

136 {

137 String line = builder.toString().trim();

138 builder.setLength(0);

139 if (!line.isEmpty())

rib.xml (https://jedit.svn.sourceforge.net/svnroot/jedit) XML · 221 lines

123 <KEYWORD3>PatchMesh</KEYWORD3>

124 <KEYWORD3>NuPatch</KEYWORD3>

125 <KEYWORD3>TrimCurve</KEYWORD3>

126 <KEYWORD3>SubdivisionMesh</KEYWORD3>

127 <KEYWORD3>Sphere</KEYWORD3>

json.jj (https://jedit.svn.sourceforge.net/svnroot/jedit) Unknown · 763 lines

87 }

88

89 private void trim() {

90 token_source.trim();

91 }

92

93 private void trimWhitespace() {

94 token_source.trimWhitespace();

309 }

310 {

311 key() <COLON> { add(": "); } value() ( <COMMA> { trimWhitespace(); add(", "); writeln(); } members() )?

312 }

313

466 }

467

468 // trim spaces from the last item in the accumulator

469 static void trim() {

question49234.sh (https://bitbucket.org/shuangxinyu/emacspack.git) Shell · 42 lines

14 .EXPORT DATA FILE "$STORE_TMP"

15 select division_id,store_id,

16 trim(store)||' '||trim(store_addr_line2_txt)||', '||

17 trim(store_city)

TextAreaTransferHandler.java (https://jedit.svn.sourceforge.net/svnroot/jedit) Java · 345 lines ✨ Summary

This Java code is part of a text editor’s implementation for handling drag-and-drop operations, specifically when dropping URLs into the editor. It handles importing and exporting data between the editor and external sources, such as files or other applications. The code provides functionality for inserting text at specific positions within the editor’s buffer.

151 if (!(vfs instanceof org.gjt.sp.jedit.io.FileVFS) || str.startsWith("file://"))

152 {

153 str = str.replace('\n',' ').replace('\r',' ').trim();

154 if (str.startsWith("file://"))

155 {

RE.java (http://ambienttalk.googlecode.com/svn/) Java · 1960 lines ✨ Summary

This Java code is part of a regular expression compiler, responsible for parsing and compiling regular expressions into an internal representation. It handles various input types, including strings, character arrays, and input streams, and provides methods for dumping the compiled regex in a human-readable format. The code also includes error handling and syntax checking to ensure valid regex patterns.

964 if (branches != null) {

965 branches.addElement(new RE(firstToken,lastToken,numSubs,subIndex,minimumLength, maximumLength));

966 branches.trimToSize(); // compact the Vector

967 minimumLength = 0;

968 maximumLength = 0;

php_calendar.php (http://phpwcms.googlecode.com/svn/trunk/) PHP · 150 lines ✨ Summary

The PHP code generates a calendar table with the current month and year, displaying days of the week and dates. It takes into account day names, weekday numbers, and user-defined links for each date. The output is an HTML string representing a calendar table, which can be used in a web page or other application to display a calendar view.

1 <?php

2

3 ////////////////////////////////////////////////////////

4

5 // PHP Calendar (version 2.3), written by Keith Devens

6 // http://keithdevens.com/software/php_calendar

8 // License: http://keithdevens.com/software/license

9

10 // enhanced by Oliver Georgi for phpwcms

11

12

105 if(isset($days[$checkDay]) && is_array($days[$checkDay])){

106 @list($link, $classes, $content) = $days[$checkDay];

107 @list($link, $target) = explode(' ', trim($link));

108 $target = $target ? ' target="'.$target.'"' : '';

109 if(is_null($content)) {

cwrpt_company1.asp (git://github.com/zhaowe/bc.git) ASP · 167 lines ✨ Summary

This ASP code generates a web page that displays flight information, including company, flight number, price, and agent fees, for a specified date range. It retrieves data from a database using ADO and formats the output into a table with colored headers and cells. If no data is found, it displays an error message with a link to another ASP page.

14 bdate=Request.QueryString("bdate")

15 edate=Request.QueryString("edate")

16 agentname=trim(Request.QueryString("ag"))

17 company=Request.QueryString("com")

18 depcity=Request.QueryString("dep")

21

22

23 if trim(agentname)="�������" then

24 sqlag=""

25 else

26 sqlag=" and agentname='"& trim(agentname) &"'"

27 end if

28

nrepl-client.factor (https://bitbucket.org/kotarak/vimclojure/) text · 0 lines

35 readln string>number ;

36

37 : read-trimmed-line ( -- line )

38 readln rest but-last ;

39

40 : read-response-chunk ( response -- response )

41 read-trimmed-line

42 { { "id" [ readln drop ] }

43 { "out" [ [ read-trimmed-line append ] change-stdout ] }

44 { "err" [ [ read-trimmed-line append ] change-stderr ] }

45 { "value" [ read-trimmed-line >>value ] }

46 { "ns" [ read-trimmed-line >>nspace ] }

47 { "status" [ read-trimmed-line >>status ] }

pickle.h (git://github.com/zpao/v8monkey.git) C Header · 278 lines ✨ Summary

This C header file defines a class Pickle that represents a serialized data structure. It provides methods for reading and writing data, including allocation and resizing of the buffer, alignment, and padding with null bytes. The class also includes functions for finding the end of the pickled data within a given range and updating iterators by a specified number of bytes.

162 // For Pickles which contain variable length buffers (e.g. those created

163 // with BeginWriteData), the Pickle can

164 // be 'trimmed' if the amount of data required is less than originally

165 // requested. For example, you may have created a buffer with 10K of data,

166 // but decided to only fill 10 bytes of that data. Use this function

167 // to trim the buffer so that we don't send 9990 bytes of unused data.

168 // You cannot increase the size of the variable buffer; only shrink it.

169 // This function assumes that the length of the variable buffer has

170 // not been changed.

171 void TrimWriteData(int length);

172

173 void EndRead(void* iter) const {

tests.php4 (https://swig.svn.sourceforge.net/svnroot/swig) PHP · 228 lines ✨ Summary

This PHP code is a comprehensive class for validating and checking various aspects of PHP code, including classes, functions, variables, resources, and more. It provides methods to check for existence, type, equality, nullness, and resource status, as well as warning and failure messages. The class can be used to ensure the integrity and consistency of PHP code before execution.

1 <?php

2

3 // do we have true global vars or just GETSET functions?

191

192 function resource($a,$b,$message) {

193 $resource=trim(check::var_dump($a));

194 if (! eregi("^resource\([0-9]+\) of type \($b\)",$resource)) return check::fail($message);

195 return TRUE;

197

198 function isnull($a,$message) {

199 $value=trim(check::var_dump($a));

200 return check::equal($value,"NULL",$message);

201 }

TwitterAlikeExample.html (http://redis.googlecode.com/svn/trunk/) HTML · 253 lines ✨ Summary

This HTML code outputs a blog post about Redis, a popular in-memory data store. The content explains how to implement a Twitter-like clone using Redis, including setting up followers and posting messages. It also discusses horizontal scaling of the system, including hashing keys, distributing user data across servers, and handling special cases like incrementing IDs and retrieving timeline data.

17 <div class="index">

18 <!-- This is a (PRE) block. Make sure it's left aligned or your toc title will be off. -->

19 <b>TwitterAlikeExample: Contents</b><br>&nbsp;&nbsp;<a href="#A case study: Design and implementation of a simple Twitter clone using only the Redis key-value store as database and PHP">A case study: Design and implementation of a simple Twitter clone using only the Redis key-value store as database and PHP</a><br>&nbsp;&nbsp;<a href="#Key-value stores basics">Key-value stores basics</a><br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#Atomic operations">Atomic operations</a><br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#Beyond key-value stores">Beyond key-value stores</a><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#The set data type">The set data type</a><br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#Prerequisites">Prerequisites</a><br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#Data layout">Data layout</a><br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#Following, followers and updates">Following, followers and updates</a><br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#Authentication">Authentication</a><br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#Updates">Updates</a><br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#Paginating updates">Paginating updates</a><br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#Following users">Following users</a><br>&nbsp;&nbsp;<a href="#Making it horizontally scalable">Making it horizontally scalable</a><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#Hashing the key">Hashing the key</a><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#Special keys">Special keys</a>

20 </div>

21

27

28 <div class="narrow">

29 <h1><a name="A case study: Design and implementation of a simple Twitter clone using only the Redis key-value store as database and PHP">A case study: Design and implementation of a simple Twitter clone using only the Redis key-value store as database and PHP</a></h1>In this article I'll explain the design and the implementation of a <a href="http://retwis.antirez.com" target="_blank">simple clone of Twitter</a> written using PHP and <a href="http://code.google.com/p/redis/" target="_blank">Redis</a> as only database. The programming community uses to look at key-value stores like special databases that can't be used as drop in replacement for a relational database for the development of web applications. This article will try to prove the contrary.<br/><br/>Our Twitter clone, <a href="http://retwis.antirez.com" target="_blank">called Retwis</a>, is structurally simple, has very good performances, and can be distributed among N web servers and M Redis servers with very little efforts. You can find the source code <a href="http://code.google.com/p/redis/downloads/list" target="_blank">here</a>.<br/><br/>We use PHP for the example since it can be read by everybody. The same (or... much better) results can be obtained using Ruby, Python, Erlang, and so on.

30 <h1><a name="Key-value stores basics">Key-value stores basics</a></h1>

31 The essence of a key-value store is the ability to store some data, called <i>value</i>, inside a key. This data can later be retrieved only if we know the exact key used to store it. There is no way to search something by value. So for example I can use the command SET to store the value <b>bar</b> at key <b>foo</b>:<br/><br/><pre class="codeblock python" name="code">

79 </pre>Ok I think we are ready to start coding!

80 <h2><a name="Prerequisites">Prerequisites</a></h2>

81 If you didn't download it already please <a href="http://code.google.com/p/redis/wiki/README" target="_blank">grab the source code of Retwis</a>. It's a simple tar.gz file with a few of .php files inside. The implementation is very simple. You will find the PHP library client inside (redis.php) that is used to talk with the Redis server from PHP. This library was written by <a href="http://qix.it" target="_blank">Ludovico Magnocavallo</a> and you are free to reuse this in your own projects, but for updated version of the library please download the Redis distribution.<br/><br/>Another thing you probably want is a working Redis server. Just get the source, compile with make, and run with ./redis-server and you are done. No configuration is required at all in order to play with it or to run Retwis in your computer.

82 <h2><a name="Data layout">Data layout</a></h2>

83 Working with a relational database this is the stage were the database layout should be produced in form of tables, indexes, and so on. We don't have tables, so what should be designed? We need to identify what keys are needed to represent our objects and what kind of values this keys need to hold.<br/><br/>Let's start from Users. We need to represent this users of course, with the username, userid, password, followers and following users, and so on. The first question is, what should identify an user inside our system? The username can be a good idea since it is unique, but it is also too big, and we want to stay low on memory. So like if our DB was a relational one we can associate an unique ID to every user. Every other reference to this user will be done by id. That's very simple to do, because we have our atomic INCR operation! When we create a new user we can do something like this, assuming the user is callled &quot;antirez&quot;:<br/><br/><pre class="codeblock python python python python python python python python python python python python" name="code">